I'm writing an ANT task that is behaving very oddly. I've tried a variety of google searches with no clear answer.
I have a compile target in ANT that calls the javac command:
<target name="compile">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}:${unittest.src.dir}" destdir="${classes.dir}">
<classpath refid="classpath" />
<exclude name="**/plugins/**" />
<exclude name="**/outbound/**" />
</javac>
</target>
That generates no errors, but when I run ant with the -verbose and -debug tags I get the following in my logs:
[javac] package/MyClass.java added as package/MyClass.class doesn't exist
So it's not erroring out, but it is giving me this odd result (with the "doesn't exist" appended at the end). Obviously this causes later targets to fail when it tries to run the classes (in this case, my junit target).
Web searches seem to indicate that I'm either missing a java_home env variable or that there is a versioning issue somewhere along the line (this error tended to occur when the source attribute on javac was set, but I removed that and am still getting the odd result). I believe we've got those possibilities covered.
Any thoughts or advice on this would be wonderful. Thanks.
I don't know too much about ant, but I would almost guess this error message is a red herring. I think it's just reporting that MyClass.java was added to the list of files to compile, because the compiled version of the class was not found on the class path. This seems to be supported by the fact that the task does not fail.
What are the later errors you are getting?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With