Open txtad opened 6 years ago
It would probably be helpful if I point out I'm using version 2.4.
Here's the plugin section from the parent pom.xml
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugins>
</build>
And from the child
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<packageName>my.package</packageName>
<target>2.2</target>
<sources>
<source>xsd/schema.xsd</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Could you create an integration test for this issue, and send as a PR?
I think we have the same issue as described by @txtad. The strange thing is that sometimes it compiles and sometimes it doesn't. We changed our configuration now from
<source>src/main/resources/xsd/schema.xsd</source>
to
<source>${basedir}/src/main/resources/xsd/schema.xsd</source>
So far it seems to work but we didn't compile that configuration very often so far. So we'll see ... Hope it helps to solve the issue (BTW: We also use version 2.4 of JAXB2 Maven Plugin)
@lennartj I see you'd asked for some test data. Would you please tell me what you need? I see this problem still exists in 2.5.0.
@funfried I can't get the ${basedir} workaround to work for me with 2.5.0. The workaround that I'm using is to create a directory inside of my master directory that has symlinks to my XML projects at the bottom of a path that completes the long path the plugin is looking for.
I created /root/path/to/parent/root/path/to/symlinktochild inside of the master project base dir.
@txtad We switched to another plugin in the meantime:
<groupId>com.github.davidmoten</groupId>
<artifactId>jax-maven-plugin</artifactId>
Because we had also issues compiling with JDK 11, maybe that's also an option for you.
@funfried Thanks for the tip. I've got this working with my workaround for now, but I'll look at jax-maven-plugin.
I just wanted to add that I'm having this problem with a build on Mac OS, but the same build on Windows works just fine.
When a working project is compiled as a module during the parent build, the path to the schema files seems to be calculated incorrectly.
/root/path/to/child/src/main/xsd/Schema.xsd
becomes
/root/path/to/parent/root/path/to/child/src/main/xsd/Schema.xsd
And the build fails because the longer path is non-existent. This fails the same way whether using the default schema location or specifying the location using the
But if one scrolls back through all the maven output, the underlying error is found: