Closed svendiedrichsen closed 8 years ago
I'll investigate if other options should be used, but this seems definitely like a bug.
I forgot to mention
Thanks very much for your instantanious response. Looking forward for any insight into this. If I can be of any help, please don't hesitate to ask.
Cheers, Sven
Is there a workaround or patch available? TIA!
Well, I can't imagine anything else than the workaround mentioned above in my initial comment.
I think the simplest solution is to add the outputDirectory of the XJC to the Maven Project's source directories. This is done whenever...
Still waiting for 2.3 to be released. @lennartj Do you have an idea, when to expect 2.3 release?
@tkn777 Possible workaround using build-helper-maven-plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/jaxb</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
From my point of view my issue is fixed with Release 2.3. Thank you very much!!
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.3.1</version>
</plugin>
http://mail-archives.apache.org/mod_mbox/axis-java-dev/201709.mbox/<165709498.20170905111249%40am-soft.de>
http://mail-archives.apache.org/mod_mbox/axis-java-dev/201709.mbox/<CADx4_uUREDZC9f%2Bwdi4PydjOgTVsdj44sp5fCdn-%3DZcjVBLrQA%40mail.gmail.com>
The provided workaround fixes the problem for me as well:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-test-sources/jaxb</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
The important point to mention here is that in Axis2 this occurs with the testXjc
goal. The problem is that the fix for this issue is incorrect. It always calls addCompileSourceRoot
, which is not the right thing to do for testXjc
. In fact it incorrectly duplicates logic that already exists elsewhere in the code (but which is skipped when code generation is skipped), instead of just reusing that logic.
Note that the proposed workaround is also incorrect in this particular case: it should use add-test-source
instead of add-source
. Using add-source
in the generate-sources
phase will allow the project to build without failure, but it will have the effect of including some of the (potentially stale) test classes into the main artifact of the project.
When you are doing a release using the maven release plugin the default output directory for generated sources 'generated-sources/jaxb' of the jaxb2 plugin does not get promoted as 'generatedSourcesDirectory' to the compiler. Instead the compiler uses the i guess default folder 'generated-source/annotations' which leads to compile errors during release. To work around this you have to set the output directory as 'generated-sources/annotations' on the jaxb2 plugin.