Closed Riduidel closed 6 years ago
Hello, also affected by this problem in jaxb2-maven-plugin versions 2.3 / 2.3.1.
Locally on windows development machine there are no problems. However, on our Jenkins Linux build-servers the plugin has problems with symbolic links in the working directory.
As such 2 source-files are generated and both paths are added automatically by the JAXB plugin to the build-path. /export/build/jenkins-localfs/workspace/.../MyJAXBClass.java /export1/build/jenkins-localfs/workspace/.../MyJAXBClass.java
This results in duplicate classes during the build.
The above behaviour is new in 2.3+. With 2.2 the Jenkins build runs without problems.
Same pb, do we have to wait for 2.4 ?
I think the underlying problem is that the plugin adds the source folder twice to the project. This would actually be fixed as a side effect of #94.
This issue come from the linked StackOverflow question.
How to reproduce it ?
On a Linux machine, create a jaxb test project under, as a example,
/home/User/project1
. Link that folder into project2. You should then have the following situationNow, in project2, run xjc transformation using jaxb2-maven-plugin. It will fail with duplicated generated classes.
How does it happens ?
In
AjbstractJaxbPlugin
, there is this code fragment which resolves the path to its canonical representationHowever, in XjcMojo, source directory is added using the following code
Which do not resolve the path to its canonical version.
As a consequence, directory is added twice to maven compiler roots, and code appear as duplicated in compiler.
How to solve it ?
Replace code in
XjcMojo
replace the method with the following codeWhy don't you fix it by yourself ?
I'm behind a corporate firewall, but will try to edit code directly on Github interface