and if there are only warnings, then the build will not fail as intended by the compiler Argument. The reason is that in compileInProcess the exit code from javac is only considered if there are no messages. In the case of treating warnings as errors, there will be messages but no errors so the intention of the build failure is lost.

Okay guys... here's your integration test. Its a simple JUnit module called 'WerrorTest.java' which uses MavenCli to call the 'compile' command on the inner module and checks that the maven output (of this invocation) contains a "unchecked call to add(e)" and has a return code 1. If these conditions are met, the unit test passes.

Alex Ioffe
added a comment - 06/Jun/11 12:37 Okay guys... here's your integration test. Its a simple JUnit module called 'WerrorTest.java' which uses MavenCli to call the 'compile' command on the inner module and checks that the maven output (of this invocation) contains a "unchecked call to add(e)" and has a return code 1. If these conditions are met, the unit test passes.

This does not directly stem from maven-compiler-plugin, it has to do with the plexus-compiler-javac and it does effect the latest version of it (1.8.1 etc...). If you take a look at werror.zip/warningsbuild/pom.xml you will see a explicit dependency plexus-compiler-javac under maven-compiler-plugin.

Alex Ioffe
added a comment - 06/Jun/11 17:29 This does not directly stem from maven-compiler-plugin, it has to do with the plexus-compiler-javac and it does effect the latest version of it (1.8.1 etc...). If you take a look at werror.zip/warningsbuild/pom.xml you will see a explicit dependency plexus-compiler-javac under maven-compiler-plugin.

Just a little clarification, in the inner pom (werror.zip/warningsbuild/pom.xml) file you will see an entry for plexus-compiler-javac version '1.8.2-SNAPSHOT'. In order to run the integration test, go to the outer pom file (werror.zip/pom.xml) and run 'mvn test' which will run the integration test.
This integration test does nothing more then call 'mvn compile' on the inner pom file and then checks the output/return code of it. In order to successfully pass the test, the inner pom file should fail the build and have a return code 1.
In order to have this integration test pass, you have to get the code for plexus-compiler-javac (svn info here: http://plexus.codehaus.org/plexus-utils/source-repository.html), make the code change to the JavacCompiler, and then deploy it to a local repo. The inner pom file will pick it up, the inner build will fail, and the integration test will pass.

Alex Ioffe
added a comment - 06/Jun/11 17:40 Just a little clarification, in the inner pom (werror.zip/warningsbuild/pom.xml) file you will see an entry for plexus-compiler-javac version '1.8.2-SNAPSHOT'. In order to run the integration test, go to the outer pom file (werror.zip/pom.xml) and run 'mvn test' which will run the integration test.
This integration test does nothing more then call 'mvn compile' on the inner pom file and then checks the output/return code of it. In order to successfully pass the test, the inner pom file should fail the build and have a return code 1.
In order to have this integration test pass, you have to get the code for plexus-compiler-javac (svn info here: http://plexus.codehaus.org/plexus-utils/source-repository.html ), make the code change to the JavacCompiler, and then deploy it to a local repo. The inner pom file will pick it up, the inner build will fail, and the integration test will pass.

Steven Schlansker
added a comment - 03/Oct/11 18:12 It seems that maven-compiler-plugin 2.4 still hasn't been released... I don't suppose that it's easy to do that? I'd love to use this bug fix but I don't want to maintain my own build unless I have to

Robert Scholte
added a comment - 05/Oct/11 16:12 It's not that hard, but we've provided some other patches for the plexus-compiler-javac. Would be nice if that one is released first before releasing the next m-compiler-p.

Kristian commented above that the Plexus compiler was fixed and that 1.8.2 was released... I can confirm that I see 1.8.2 on various Maven mirrors. Is that not sufficient? (Sorry, I don't know too much about the dependencies here, I just want to offer to go bug whoever is blocking this from getting out so I can use it!)

Steven Schlansker
added a comment - 05/Oct/11 16:19 Kristian commented above that the Plexus compiler was fixed and that 1.8.2 was released... I can confirm that I see 1.8.2 on various Maven mirrors. Is that not sufficient? (Sorry, I don't know too much about the dependencies here, I just want to offer to go bug whoever is blocking this from getting out so I can use it!)

If you are compiling down with -source / -target, and not supplying -Xbootclasspath, you get a warning at the outset. That stops the process with -Werror unless you then also use -Xlint:-options to turn this off. I can't explain the apparent influence of deprecation/warning control.

Benson Margulies
added a comment - 01/Feb/15 16:08 Here's the story.
If you are compiling down with -source / -target, and not supplying -Xbootclasspath, you get a warning at the outset. That stops the process with -Werror unless you then also use -Xlint:-options to turn this off. I can't explain the apparent influence of deprecation/warning control.