Also ensure that fork="yes".
Peter
On 5/31/07, David Alves <[EMAIL PROTECTED]> wrote:
Can you use a <jvmarg> nested inside your <java> tag to specify the -ea
parameter?
Something like:
<java classname="MyClass">
...
<jvmarg value="-ea" />
</java>
-----Original Message-----
From: Doron Cohen [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 31, 2007 1:16 PM
To: [email protected]
Subject: how to enable Java assertions (ie how to pass '-ea' to the jvm)
Hi, probably a trivial question but I couldn't find a
working answer in the docs/archives/wiki/bugs. I have
a Java assert statement in my code that is supposed
to fail. Java compilation is with -source 1.4, which
compiles these assertions.
When running from Java command line, like this:
java -ea junit.textui.TestRunner MyTestClass
or like this
java -enableassertions junit.textui.TestRunner MyTestClass
The assert (this is not Junit assert, it is a
Java assert) catches the bug and fails.
But when running the same test case with ant:
ant test
The assert is not applied and the test passes.
Setting ANT_OPTS to '-ea' or to '-enableassertions'
did not work. This is with both ant 1.7.0 and 1.6.5.
Now this is especially puzzling, since ANT_OPTS does
seem to work. For instance, when I set ANT_OPTS to
'-version', running "ant test" prints the Java version,
just as running "java -version" prints it.
The Java version btw is HotSpot 1.5.0_06.
OS is Windows XP.
Thanks,
Doron
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]