Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAMEL-11942: Switched to jaxb2-maven-plugin for camel-spring schemagen #2099

Merged
merged 1 commit into from
Nov 21, 2017

Conversation

sermojohn
Copy link
Contributor

This fix makes the build succeed on windows.

@davsclaus
Copy link
Contributor

@johnpoth was there something about this maven plugin was not working on java 9 ?

@sermojohn did you by any chance test this with java 9 as well.

@johnpoth
Copy link
Member

Hi @davsclaus, you're right the plugin doesn't work in Java 9, the issue is still open. @sermojohn We use CXF's xjc plugin in the meantime.

@sermojohn
Copy link
Contributor Author

Hi @johnpoth and @davsclaus ,
I will follow your suggestion to use cxf xjc plugin for Java 9 builds.

@oscerd
Copy link
Contributor

oscerd commented Nov 20, 2017

@johnpoth what do you think about the update?

@sermojohn
Copy link
Contributor Author

I did not find a schemagen goal available in cxf's xjc maven plugin, so I assume it is not available.

However, there is a work-around for jaxb2-maven-plugin on Java 9, by manually setting the missing dependencies of the plugin.
Reference: https://stackoverflow.com/questions/46356092/jaxb2-maven-plugin-failing-on-java-9

@johnpoth
Copy link
Member

Unit tests are failing On Java 9. Looks like there is a problem with the generated schema:

[ERROR] testWireTap(org.apache.camel.spring.xml.SpringXmlRouteBuilderTest)  Time elapsed: 0.017 s  <<< ERROR!
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from class path resource [org/apache/camel/spring/xml/buildWireTap.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://camel.apache.org/schema/spring/camel-spring.xsd; lineNumber: 1; columnNumber: 242; s4s-elt-schema-ns: The namespace of element 'schema' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
        at org.apache.camel.spring.xml.SpringXmlRouteBuilderTest.getRoutesFromContext(SpringXmlRouteBuilderTest.java:102)
        at org.apache.camel.spring.xml.SpringXmlRouteBuilderTest.buildWireTap(SpringXmlRouteBuilderTest.java:68)
Caused by: org.xml.sax.SAXParseException: s4s-elt-schema-ns: The namespace of element 'schema' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
        at org.apache.camel.spring.xml.SpringXmlRouteBuilderTest.getRoutesFromContext(SpringXmlRouteBuilderTest.java:102)
        at org.apache.camel.spring.xml.SpringXmlRouteBuilderTest.buildWireTap(SpringXmlRouteBuilderTest.java:68)

@sermojohn can you reproduce? If this is another problem with the plugin you can try out the native schemagen which we use for camel-blueprint

@sermojohn
Copy link
Contributor Author

@johnpoth thank you for the notice. Indeed they are failing on my side as well. I believe that camel-blueprint will have the same issue that I am trying to fix for camel-spring module.

The problem seems to be that XML schema generation ignores some namespace prefixes, which results in parsing errors when trying to use the generated XML schema (on Java 9). I spent some time on this but have not found what causes this behavior.

@johnpoth
Copy link
Member

@sermojohn I don't see it worthwhile spending too much time on this as the jaxb2-maven-plugin team are working on supporting Java 9.
An alternative way of fixing this issue is to add the namespace yourself via the maven-antrun-plugin. Here's the diff forked from your PR. I've tested it and tests run successfully on camel-spring and camel-spring-test projects. Let us know if it works on windows. Thanks!

@sermojohn
Copy link
Contributor Author

sermojohn commented Nov 21, 2017

@johnpoth thank you very much. This work-around works on windows as well.

@onderson
Copy link
Contributor

Have not tested with JDK 9. My initial problem where i had JDK8 with this fix seems OK..
if @johnpoth and @sermojohn confirms that is OK with JDK 9 with this PR, i think we can squash, rebase and merge the PR. Thanks folks.

PS : I have seen on the net many people said they used long path tool where i could not find relevant documentation to fix. This PR looked better Thanks guys involved.

… using exec-maven-plugin. This fix makes the build succeed on windows. Also applied a work-around for correct schemagen on Java 9.
@johnpoth
Copy link
Member

LGTM

@sermojohn
Copy link
Contributor Author

squashed and rebased. ready for merge.

@onderson onderson merged commit 09f9f32 into apache:master Nov 21, 2017
@PascalSchumacher
Copy link
Contributor

Thanks for this pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants