Eric (9) [Avatar] Offline
#1
Im using Ant inside of Eclipse with jdk1.4.2_04 and the -ea switch. My version of Eclipse has Ant 1.6.1 jarred into it. My build fails saying that assert is a keyword in 1.4 and not a statement.

Is there someplace inside the build file that I need to specify something like -source 1.4?

Thanks much,
- Eric
ErikHatcher (211) [Avatar] Offline
#2
Re: build complains about assert keyword
I've not tried this, but the assertions element under javac should do the trick. See this: http://ant.apache.org/manual/CoreTypes/assertions.html
Eric (9) [Avatar] Offline
#3
Re: build complains about assert keyword
Thanks for the quick reply Erik, and the link. It seems that javac *doesn't* support assertions at all, and lumping them in with the compile target didn't make them work either.

What makes the compile happy is to set the source attribute of javac to "1.4" (or 1.5 too I'm sure).

I'm guessing that the assertions datatype has more to do with the java task (maybe as a jvmarg?), although I haven't gotten that far into your book yet to know how to set up a test yet. Wish your book was smaller smilie, but its got a lot in there obviously.

- Eric
ErikHatcher (211) [Avatar] Offline
#4
Re: build complains about assert keyword
Keep in mind that the assertions stuff within Ant is newer than our book covers, so we're a bit off the beaten path here smilie