Reputation: 15953
In case of compilation errors, ant javac
task will not compile all classes which can be compiled. It seems that the javac
task (or the compiler itself) just stops as soon as the first error is encountered.
The failonerror
property does not have any impact to this behavior.
I'm not setting the compile
attribute (hence, the Oracle JDK's compiler is used).
Is it possible to compile as most classes as possible in case of compilation errors?
(preferably not relying on any specific compiler)
One use case for this is during development:
Imagine that you're implementing some new functionality but you're not finished and compile errors remain.
In the meanwhile you need to fix some other bug and to ensure nothing is broken you want to execute the standard test suites which are invoked by an ant task in the project workspace of your IDE. The ant task tries to compile all classes/test classes but fails due to compile errors in the class you're just developing.
It would be very helpful to tell ant/javac to not fail on compile errors in order to be able to execute as most test cases as possible.
Upvotes: 4
Views: 678
Reputation: 10294
That has nothing to do with ant
, it's javac
that will stop on error and never give you any class file.
The failonerror
property just say if the build should continue or stop if compilation sends back an error.
Since 1.3 : http://docs.oracle.com/javase/1.3/docs/tooldocs/tools-changes.html
"When the new 1.3 compiler detects an error in a source file during a compilation, it continues to parse the remaining source files and attempts to identify any further errors that they may contain. Code generation is completely suppressed for the remainder of the compilation, however, and no class files will be generated, even for compilation units that contain no errors."
You may want to use some other compilers like jikes. But really, who would want partially compiled classes to be run ?
Upvotes: 3