Open chevalleyc opened 5 years ago
Hello chevalleyc. Is there a fix for this xml-beans compile error against Java 11 or are you still using the workaround? The error I am getting is:
Failed to execute goal org.codehaus.mojo:xmlbeans-maven-plugin:2.3.3:xmlbeans (default) on project
To be able to use the xmlbeans-maven-plugin with Java 11, add the following configuration element:
<javaSource>1.8</javaSource>
When I added
Have you evaluated migrating to EHRbase? EHRbase 1.0 (early April 21) will support FLAT json format along with canonical JSON and XML. There has been a tremendous development effort on this platform since 1 1/2 year. I would recommend you give it a try if not already done. Cheers!
There has been recent activity in the XmlBeans project, but I was unable to successfully use the org.codehaus.mojo:xmlbeans-maven-plugin[:2.3.3]
plugin with newer versions.
Apparently one of the changes in XmlBeans 5 is its own Maven plugin, which seems like the long-term solution, but I'm not prepared to make the switch just yet.
However, I've actually found an interim workaround to stick with the older XmlBeans 2.x library, by combining the following two options:
<javaSource>1.5</javaSource><!-- only "1.5" is actually recognized, others values revert to "1.4" code -->
<noJavac>true</noJavac><!-- prevent XmlBeans from calling javac directly with "-source 1.5", which is unsupported on new Java versions -->
In this configuration, XmlBeans will generate its binary information, along with its Java 1.5-compatible source (including List<...> methods). Meanwhile, the noJavac
option avoids the internal Javac call that results in the unsupported error on Java 11:
warning: [options] bootstrap class path not set in conjunction with -source 5
error: Source option 5 is no longer supported. Use 6 or later.
error: Target option 1.5 is no longer supported. Use 1.6 or later.
In my configuration, the generated source code is attached as a source directory that is processed by the standard maven-compiler-plugin
, which happily accepts the older source code with whatever source
version you have configured (or is automatically selected) in your project.
@robbytx could you share your pom.xml since I don't know how to include the bean files that is needed for compilation.
Sorry @mpet, I've changed companies since my comment and I no longer have access to the project where this was in use.
I believe the POM at the top of this issue shows how to generate the sources using the older plugin. Many Maven plugins that generate source code will automatically "attach" the generated source code directory to the project so that it will be included in compilation. If that's not happening for you, then you can use the build-helper-maven-plugin to explicitly add the directory where XmlBeans emits its sources. Hope that helps.
Hi, can anyone help me regarding this matter
I was trying to update my code to java 11 but can't able to build due to this XML beans
The error I am getting
Error: bootstrap class path not set in conjunction with - source 1.4 Error: source option 1.4 is no longer supported. Use 6 or later Error: Target option 1.4 is no longer supported. Use 6 or later
Org.codehaus.mojo.xmlbeans.xmlbeansexception: compile failed
@himukk did you try adding <noJavac>true</noJavac>
to your <configuration>
element for the plugin? I discussed this issue in my comment above.
It worked
Thank you
The workaround is for now to force using java 8 in pom.xml as follows:
the
compiler
parameter should specify an alternative path to a java 8 compiler.