How to enable asserts when building with Ant
Hello,
Can anyone explain how to setup IDEA to allow asserts when building via Ant.
I have an assert statement in a java source file. Using Ant's javac task to compile gives the following errors:
xxx.java (1064:9)not a statement
xxx.java:1064: not a statement
xxx.java (1064:16)';' expected
xxx.java:1064: ';' expected
The line in question is:
assert !objects.isEmpty() : "no object defined";
In my IDEA settings JDKs I have JDK1.4.2_02 set.
Further in my Ant build.xml file I have the following property set:
]]>
My understanding is that Ant uses the default JDK or a sdpecific JDK version if the global "build.compiler" property is set. Both of these are true in my case yet the build errors are those that I would expect to see if a
pre 1.4 javac was used for the compilation.
Thanks,
Tim Mowlem
请先登录再写评论。
With respect to my question I forgot to mention that I have also checked the "Enable asserts keyword" checkbox in the Project Paths settings and restarted IDEA.
You need to add a "source" attribute to your javac tasks, with argument "1.4". Here's an example.
]]>
--Dave Griffith