Discussion:
unit test works in Eclipse but fails in maven
Kent Tong
2006-06-12 02:04:23 UTC
Permalink
Hi,

I have some junit tests and they pass if they're run in Eclipse. If
they're run from the Eclipse maven2 plugin or from maven2 directly,
many of them fail. I was trying to debug it by:

set MAVEN_OPTS=-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-Xnoagent
-Djava.compiler=NONE

but it just won't stop at the breakpoints that I set in Eclipse.
Any idea on:
1) How to debug in this situation?
2) Typically what make cause this weird behavior (failing in
maven only)?

Thanks!
--
Kent Tong, Msc, MCSE, SCJP, CCSA, Delphi Certified
Manager of IT Dept, CPTTM
Authorized training for Borland, Cisco, Microsoft, Oracle, RedFlag & RedHat
triley
2006-07-15 00:00:29 UTC
Permalink
I had the same problem and I found this... Hope it helps
http://docs.codehaus.org/display/JETTY/Debugging+with+the+Maven+Jetty+Plugin+inside+Eclipse

Tim
--
View this message in context: http://www.nabble.com/unit-test-works-in-Eclipse-but-fails-in-maven-tf1771802.html#a5335955
Sent from the Maven - Users forum at Nabble.com.
dan tran
2006-07-15 03:18:21 UTC
Permalink
the sure plugin invokes another jvm to run the test, you need to configure
the debugger with surefire, not maven

<plugin>
<artifactId>maven-surefire-plugin</artifactgId>
<configuration>
<argLine>Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -
Djava.compiler=NONE </argLine
</configuaration>
</plugin>
Post by Kent Tong
Hi,
I have some junit tests and they pass if they're run in Eclipse. If
they're run from the Eclipse maven2 plugin or from maven2 directly,
set MAVEN_OPTS=-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-Xnoagent
-Djava.compiler=NONE
but it just won't stop at the breakpoints that I set in Eclipse.
1) How to debug in this situation?
2) Typically what make cause this weird behavior (failing in
maven only)?
Thanks!
--
Kent Tong, Msc, MCSE, SCJP, CCSA, Delphi Certified
Manager of IT Dept, CPTTM
Authorized training for Borland, Cisco, Microsoft, Oracle, RedFlag & RedHat
---------------------------------------------------------------------
Jimisola Laursen
2006-07-17 10:08:07 UTC
Permalink
Hi!

I had a similar problem that was because of assertions. Assertions where
enabled when running test from console Maven, but disabled when running
tests using Eclipse.

Regards,
Jimisola
--
View this message in context: http://www.nabble.com/unit-test-works-in-Eclipse-but-fails-in-maven-tf1771802.html#a5358371
Sent from the Maven - Users forum at Nabble.com.
Kaare Nilsen
2007-02-19 14:00:36 UTC
Permalink
Post by Jimisola Laursen
Hi!
I had a similar problem that was because of assertions. Assertions where
enabled when running test from console Maven, but disabled when running
tests using Eclipse.
Did you find any good reason for this, and how did you eventually work
around it ?
Post by Jimisola Laursen
Regards,
Jimisola
--
View this message in context: http://www.nabble.com/unit-test-works-in-Eclipse-but-fails-in-maven-tf1771802.html#a5358371
Sent from the Maven - Users forum at Nabble.com.
---------------------------------------------------------------------
Kaare Nilsen
2007-02-19 14:10:07 UTC
Permalink
Post by Kaare Nilsen
Post by Jimisola Laursen
Hi!
I had a similar problem that was because of assertions. Assertions where
enabled when running test from console Maven, but disabled when running
tests using Eclipse.
Did you find any good reason for this, and how did you eventually work
around it ?
Solved btw.. fingertrouble in the configuration of surefire
Post by Kaare Nilsen
Post by Jimisola Laursen
Regards,
Jimisola
--
View this message in context: http://www.nabble.com/unit-test-works-in-Eclipse-but-fails-in-maven-tf1771802.html#a5358371
Sent from the Maven - Users forum at Nabble.com.
---------------------------------------------------------------------
Loading...