-
Notifications
You must be signed in to change notification settings - Fork 100
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
Support schema bindings on Java 9 #120
Comments
Java 9 is generally not supported yet. |
See also #114. |
The question is whether that will change. 😃 (And if so, when.) |
@highsource Hi Lexi! Boris from Disy here. Do you already have a plan for Java 9 compatibility? Is there any way we can support work on this? (Bounty, Contract work, ...) Or if you have any pointers to potentially necessary implementation changes we could evaluate whether we can invest some time into it. |
@aggregat4 Hi Boris. :) I don't have any plans for Java 9 yet, so I can't say anything specific. :( I think the best would be if some of your devs could check what the specific problems with Java 9 are. We could then think of how to solve them. |
I looked at this long and hard together with @aggregat4 but we did not make any meaningful progress on the plugin. What we found out:
As it stands I assume I am not using the API in the exact same way as the plugin does (although I tried to copy it). Maybe you can have a look? These two projects might help:
|
@highsource our current state of investigation on this issues is the following:
Our question now is: Could we count on some support from your side to assist in identifying the problem? Would there be any way to motivate you to do this (monetary? cake? ;) )? If so, when would you have time? If you don't see a possibility there, we will probably write a minimal maven plugin ourselves that just shells out to the XJC command line tool. |
This will be solved (no additional motivation required), but I can't promise a specific date. To be sure - the specific problem you have is that bindings not applied, correct? |
That's great news! 😃
Yes. I just opened #126 to share what I've got so far, including a test case showing that class and package names are ignored. The binding generating |
I am positively puzzled. Bindings seem to be processed (wrong element names produce an error) but not applied. |
For some reason when schema is loaded, Digging further I've found that there are differences in
But it is:
Note that Now the question is, why namespaces are missing. Namespace is provided by |
Indeed,
Returns |
com.sun.tools.xjc.reader.xmlschema.bindinfo.package-info package.
Seems like I've managed to fix it. I guess there was a classloader issue which prevented annotations from I've added preloading of this packaged and it worked. Now I can build the Please check if this works for you (build from the Don't close yet, I want to check why |
I tried your changes (more precisely 1948a6b) and it indeed passes the test I wrote. Using it on the actual project failed, though:
I did not have time to look into it yet or to reproduce it with a simple test case. Do you have an idea what could be going on here? |
By and large it looks good, but the problem above (as well as another one) persist. I hope to have some time next week to create a minimal, self-contained demonstration. |
would be great |
I found a similar problem about the schema bindings are apparently not applied. If same xsd file has several point in the filename for example STRANGE_PREFIX.FILE_NAME.XSD the xjc work but not applied the globalBindings like choiceContentProperty. I tested with java8 and java7. |
To give some context, we have 95 Maven projects that use this plugin, 71 of which rely on bindings. Before I opened this issue we could build the 24 non-binding projects. With your changes, we could build 68 of the remaining 71. 👍 Class Cast ExceptionOne of the remaining three projects threw the error above:
It took me a while to figure out that the easiest fix is to no longer add the java.xml.bind module to the Maven process. It's required with 0.13.2 but I assume the update to jaxb-api-2.3.0-b170201.1204 made that unnecessary. It's weird that the clash only happened in one project (it's the JAXB-heaviest, though) but I didn't investigate why. Stubborn BindingsIn the two remaining projects the plugin continued to not honor the bindings. We spent some time looking at it but eventually pulled the plug and just made it work without them (it was just about a handful There is another project that is even heavier on JAXB, though, so I may have to face the music eventually. In that case, I'll be back with more information. What Now?Bindings generally work now and I'm happy with the situation. 😃 I think this issue can be closed once the solution is merged into master. I would file any further problems as a bug then. |
Hey folks, thanks at first for your efforts to make it complaint with java 9.
any clues what I can do with it ? |
That problem has something to do with episode files. I have no clue what those are and what they're used to, but the solution is to put |
@nicolaiparlog thx for the tip. Applied your suggestion and it works! Thx a lot. |
@highsource Hi again. Just a quick question. Are there any plans to release java-9 branch of this plugin ? Thx in advance. |
In principle, yes, I consider adding Java 9 support. |
There's progress. Build under Java 9 slowly starts to work. Most of the project can be build under Java 9 now, around half of the test projects work. I'll continue working on it the next days. |
@nicolaiparlog @ptahchiev @aznan2 Please try building the maste branch under Java 9:
Works for me now. |
The build works using a normal |
@aznan2 Hm, I wonder how comes that you have
|
@highsource It seems the catalog file in tests/MAVEN_JAXB2_PLUGIN-53/b/src/main/resources/catalog.cat contains the line
If I change 0.9.2 to 0.14.0 the build works. |
@aznan2 Ah, right. Then it's clear why it's failing for you and not for me: I've got this snapshot version from the (very) old builds. I've corrected this, please try again. |
@highsource Yes, it works now. Woo! |
Just compiled master inside Eclipse with JDK10 and am using it in my project. Both manual as well as automated (m2e) runs are working fine. The bindings.jxb file is properly applied. Initial issues with the automated run (m2e) I could fix by replacing I suggest you push a release, so you get a wider coverage of bugs. |
+1 |
Thanks a lot ! |
@aggregat4 @paroxysm @adlmez @aznan2 @kevemueller I've just released Please test it.
Java 1.6 is no longer supported. |
@highsource cheers, will test soon. |
Hi Guys, @highsource is multiple namespaces supported at the moment? Also, one importing another? If so, do I need a special setting to enable it? |
@divanmostert Multiple namespaces should be no problem. Do you experience any difficulties? Please open a separate issue if you do. |
Ok, thanks - just scaling down my problem, so will be in touch if I can't resolve it. |
Hello, just stumbling in because I've got an error message because of "com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver" being unaccessible as a superclass of MavenCatalogResolver - the internal class is not exported within Java 9 by default, and it seems it's no more available in JDK10 (looked only at src.jar, as I don't really use it, yet). For JDK 9, I added these parameters to .mvn/jvm.config: Plugin dependency: This combination works for me (I know, the dependency is mentioned in the thread before, but so it's easier to copy for others looking here for support ;-) ) |
Just in case anyone stumbles over this bug, while trying to figure out their https://stackoverflow.com/questions/52157040/jaxb-package-info-ignored-when-using-java-10 and the magic solution, if you are using this plugin:
since there seems to be a nasty regression in the jdk, or something about how maven is setting up the classloader when I run my code inside a mojo. For me, the kicker was I could unmarshal my XML using classes generated from schema by maven, if I ran my code within eclipse. But, if I ran my code as a maven plugin, it failed. The way they are searching for the package-info.java file doesn't work when the classes are loaded by the maven class loader. |
When running on Java 9, schema bindings are apparently not applied - instead the XSD's namespace is used to determine the package.
Description
It makes no difference whether this block is present in the XSD...
... or this block in a
bindings.xjb
...... in both cases, the binding is ignored.
Experiments
I observed that the
xjc
command line tool in Java 8 and 9 exhibits the expected behavior and that the difference between the Maven run on Java 8 and 9 was that the former usesrt.jar
as JAXB API, while the latter uses the plugin's dependencyjavax.xml.bind:jaxb-api
.It took me a while but eventually I got the Java 9 Maven build to say Java JAXB API is loaded from the [jrt:/java.xml.bind], i.e. it used the Java 9 module java.xml.bind but that still didn't do the job.
Sources
Maybe one of these can help (I'm shooting in the dark here, could be utterly irrelevant):
org.apache.cxf:cxf-xjc-plugin
instead - maybe they're doing something differently?Related to #114.
The text was updated successfully, but these errors were encountered: