ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Alves" <dal...@brnphoenix.com>
Subject RE: how to enable Java assertions (ie how to pass '-ea' to the jvm)
Date Thu, 31 May 2007 21:08:36 GMT
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:DORONC@il.ibm.com] 
Sent: Thursday, May 31, 2007 1:16 PM
To: user@ant.apache.org
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message