jaxb2-maven-plugin
jaxb2-maven-plugin copied to clipboard
Incorrect $basedir calculation between Windows & Linux
We have found few issues in jaxb2-maven-plugin with both latest version 2.5.0 and 2.4 that makes it unable to find XSD files in some situations.
We are downgrading to 2.3.1 were we are unable to reproduce the issues
Informations:
We have a multi maven project with the following supported mode of build:
- maven build windows -> xjc/schemagen ok
- m2eclipse build windows ->xjc/schemagen ok
- maven build linux -> xjc ok / schemagen $basedir KO
- m2eclipse build linux -> xjc $basedir KO / schemagen $basedir KO
10/29/19, 8:42:28 PM GMT: [ERROR] null [-1,-1] schema_reference.4: Failed to read schema document 'file:/root/eclipse-201909/root/0src/......', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. 10/29/19, 8:42:28 PM GMT: [DEBUG] Accepted configured sources [/root/0src/...xsd]
As you see my sources are in /root/0src/ but the plugin look at some point for <ECLIPSE_ROOT>/root/0src/
We had previously another problem specific under Linux by asking the schemagen goal to look for a *.java files with a relative folder change "../../" , the plugin has always removed the first / of the generated absolute path at some point and this lead to a similar issue than /etc != etc.
We solved it by using the dependency plugin and the local repo rather than relative paths that is anyway bad practice, but I believe with experienced a similar issue.
Yet I'm out of idea, I'm been testing relative, absolute paths, $basedir, $project.build.directory, pluginManagements conf, nothing worked except downgrading to the 2.3.1 version of jaxb2-maven-plugin
We are also using jaxws-maven-plugin under Windows & Linux but we never experienced such troubles setting it up.
Blocker issue here.
maybe related to https://github.com/mojohaus/jaxb2-maven-plugin/issues/153
Not sure from the description if my problem is related but when using variables to get to WSDL path on Windows machines it seems like the plugin then has issues converting the String to a URL. The error is "Could not create the URI from string"
I would use this
The process then fails on error "Could not create the URI from string"
When I then hardcode the location with the forward slashes then it works
It does not seem like the function used to convert the string to a URI is windows compliant. Surely it should know that backslashes are used on windows. As we do not formulate the variable project.basedir but its done by Spring boot it would be highly appreciated if this could be rectified in this plugin.
Minimal project structure to reproduce:
test
|
|-- parent
| |--pom.xml
|
|-- sub
|--pom.xml
|--src/main/resources/schema.xsd
In which parent is a multi module project and sub uses the jaxb2-maven-plugin.
Workaround for windows would be to hardcode schema url like this (note file:/// prefix):
<schema> <url>file:///c:/workspace/projects/some-project/src/main/schemas/my.wsdl</url> </schema>
I have the same problem as class101 on a Mac. Is it possible to cherry-pick 41c629cd585a0664c8e84569b68457cb8586c31c on a new branch from the release 2.5.0 and release an official 2.5.1 version with the fix?
Hello @lennartj, I asked a month ago if a fixed version 2.5.1 could be released but I've got no answer yet. Can you please tell me who should I ask directly with a release request?
For me, this is resolved with jaxb2 v3.1.0(finally!)
Version 3 generates classes with dependecies on the package jakarta. We're not ready to move to jakarta yet. For anyone else that is having problems of generating java classes in Eclipse - we've migrated to org.jvnet.jaxb2.maven2: maven-jaxb2-plugin:0.15.2. It works great.