This appears to be a bug in jaxb2-maven-plugin. If clean is not executed, then that plugin skips code generation (which is correct), but then it also skips the following line of code:
https://github.com/mojohaus/jaxb2-maven-plugin/blob/jaxb2-maven-plugin-2.3.1/src/main/java/org/codehaus/mojo/jaxb2/javageneration/AbstractJavaGeneratorMojo.java#L434 That means that the output directory is not added to the list of test sources, resulting in compilation failures. Andreas On Tue, Sep 5, 2017 at 10:12 AM, Thorsten Schöning <[email protected]> wrote: > Hi all, > > I'm facing the problem that when I execute goals like "install" or > "test" without "clean" the build of some projects fail, the problem > seems to be with an existing or not "target" dir and it looks like > that because of that the build of some projects "thinks" it doesn't > need to compile classes etc. Which would be fine if it wouldn't delete > the formerly created classes itself without re-creating them! :-) > > One example is with axis-metadata, were the following command fails > after a former successful build: > >> mvn test --projects :axis2-metadata > > While the following one succeeds: > >> mvn clean test --projects :axis2-metadata > > "clean" deletes the whole "target" dir, so a fresh new build is > executed. Without "clean", pre-compiled classes in > "target/test-classes" are deleted, but not re-created for some reason, > resulting in error messages like the following: > >> [ERROR] Failed to execute goal >> org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile >> (default-testCompile) on project axis2-metadata: Compilation failure: >> Compilation failure: >> [ERROR] /C:/Users/tschoening/Documents/Eclipse/Java >> Axis2/axis2/modules/metadata/test/org/apache/axis2/jaxws/description/DocLitWrappedImplWithSEI.java:[23,36] >> package org.test.proxy.doclitwrapped does not exist > > Classes of "org.test.proxy.doclitwrapped" were available in the last > successful build and have been deleted, but no re-created. the > interesting thing as well is that really only the Java classes > themselfs have been deleted, the corresponding parent dir already > exists: > >> C:\Users\tschoening\Documents\Eclipse\Java >> Axis2\axis2\modules\metadata\target\test-classes\org\test\proxy\doclitwrapped > > I have that problem with various projects and it was driving me crazy, > because things like "Debug as/Maven test" etc. per project directly > from Eclipse were not working and such. I really need to always > execute "clean" in addition to the other goals to be sure a build > works. > > Is that intended or some kind of build issue? Shouldn't "mvn install" > not only delete pre-compiled test classes, but also be able to create > them again? > > Mit freundlichen Grüßen, > > Thorsten Schöning > > -- > Thorsten Schöning E-Mail: [email protected] > AM-SoFT IT-Systeme http://www.AM-SoFT.de/ > > Telefon...........05151- 9468- 55 > Fax...............05151- 9468- 88 > Mobil..............0178-8 9468- 04 > > AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln > AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
