Closed cachescrubber closed 1 year ago
Hi @cachescrubber : I've done PR https://github.com/highsource/jaxb2-basics/pull/165 to migrate to jakarta namespace and take back all plugins mentionned here (since not working with jakarta) Feel free to comment
@cachescrubber PR merged The repo is being merged into jaxb-tools main project (original maven-jaxb-plugin) to make jakarta migration available soon
@cachescrubber UPDATE of the issue : we decided, in order to provide jakarta versions of all artifacts, to merge all jaxb-related repositories in former maven-jaxb2-plugin repository, renamed as jaxb-tools. Everything still splitted (and as independant as it should be) and will stay splitted in maven artifacts.
README.md has been up-to-date in jaxb-tools. After jakarta migration, we'll do some cleanup on "deprecated" repositories, adding mentions in README.md and releasing a latest version with maven relocation infos.
You can use the following to build with remaining plugins mentioned in this issue without depending on external resources. Feel free to get back if any problems
<dependency>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb2-basics-tools</artifactId>
<version>2.0.4</version>
</dependency>
Hi @laurentschoelens I just gave it a try.
This is where I come from:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<defaultOptions>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-xjc-Xcommons-lang</extraarg>
<extraarg>-xjc-Xfluent-api</extraarg>
<extraarg>-xjc-Xvalue-constructor</extraarg>
<extraarg>-xjc-Xdefault-value</extraarg>
</extraargs>
</defaultOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-commons-lang</artifactId>
<version>${jaxb2-commons-lang.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-fluent-api</artifactId>
<version>${jaxb2-fluent-api.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-value-constructor</artifactId>
<version>${jaxb2-value-constructor.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-default-value</artifactId>
<version>${jaxb2-default-value.version}</version>
</dependency>
</dependencies>
</plugin>
If I understand you correctly, I should replace the individual plugin dependencies using jaxb2-basics-tools
.
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<defaultOptions>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-xjc-Xcommons-lang</extraarg>
<extraarg>-xjc-Xfluent-api</extraarg>
<extraarg>-xjc-Xvalue-constructor</extraarg>
<extraarg>-xjc-Xdefault-value</extraarg>
</extraargs>
</defaultOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb2-basics-tools</artifactId>
<version>2.0.4</version>
</dependency>
</dependencies>
</plugin>
A plugin execution failed with the following error:
WARNING] at org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java.main(ForkOnceWSDL2Java.java:51)
[WARNING] Caused by: com.sun.tools.xjc.BadCommandLineException: unbekannter Parameter -Xcommons-lang
[WARNING] at com.sun.tools.xjc.Options.parseArguments(Options.java:856)
[WARNING] at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:410)
[WARNING] ... 8 more
Using jaxb2-basics
instead of jaxb2-basics-tools
it seems to find the plugins. Again, a plugin execution then failed with
[WARNING] at org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java.main(ForkOnceWSDL2Java.java:51)
[WARNING] Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
[WARNING] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
[WARNING] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
[WARNING] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
[WARNING] ... 23 more
<dependency>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>2.0.4</version>
</dependency>
Yes, I always mismatch jaxb2-basics-tools
with jaxb2-basics
which is the good import.
But 2.0.4 is still based on javax
namespace. Jakarta will be supported as 3.x and 4.x versions.
Which version of cxf-plugin do you use ?
<!-- apache cxf codegen and xjb plugins -->
<apache-cxf-codegen-plugin.version>4.0.2</apache-cxf-codegen-plugin.version>
<apache-cxf-xjc-plugin.version>4.0.0</apache-cxf-xjc-plugin.version>
Yes cxf 4.x is based on jakarta
so I'm not surprised of the result.
Okay, I misunderstood you regarding javax / jakarta. I updated my JavaEE branch (uising cxf 3.6.1) accordingly and It worked.
Jakarta is on it's way. Should come soon
I upgraded my build (see comment above) using
<dependency>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-plugins</artifactId>
<version>3.0.1</version>
</dependency>
Everything is working as expected.
@laurentschoelens and @mattrpav - Big thank you for keeping this up!
There are a bunch of other community driven Jaxb2 / XJC plugins which are published under the groupId org.jvnet.jaxb2_commons
The repository is https://github.com/javaee/jaxb2-commons
It seems the basics plugin has origins there too. I stumbled upon those while trying to migrate builds that where using those to the JakartaEE9 era.
Here is a small PR of mine upgrading them: https://github.com/javaee/jaxb2-commons/pull/46
@mattrpav The original javaee/jaxb2-commons project I mentioned seems to be abandoned. The plugins are published under the same groupId as the basics plugin. It seems this project is able to publish to maven central. So my question is if we could take over the remaining plugins and roll out a maintenance + JakarteEE9 ugrade release? I' happy to contribute and help out.