You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 situation
project1
project2 => project1
Now, 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 representation
// 4) If the output directories exist, add them to the MavenProject's source directories
if(getOutputDirectory().exists() && getOutputDirectory().isDirectory()) {
final String canonicalPathToOutputDirectory = FileSystemUtilities.getCanonicalPath(getOutputDirectory());
if(log.isDebugEnabled()) {
log.debug("Adding existing JAXB outputDirectory [" + canonicalPathToOutputDirectory
+ "] to Maven's sources.");
}
// Add the output Directory.
getProject().addCompileSourceRoot(canonicalPathToOutputDirectory);
}
However, in XjcMojo, source directory is added using the following code
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.
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
The text was updated successfully, but these errors were encountered: