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

Mapping of old Java EE artifacts to new Jakarta artifacts #205

Open
sebersole opened this issue Sep 20, 2021 · 12 comments
Open

Mapping of old Java EE artifacts to new Jakarta artifacts #205

sebersole opened this issue Sep 20, 2021 · 12 comments

Comments

@sebersole
Copy link

Would be awesome if there were an actual mapping of artifacts from Java EE -> Jakarta EE.

E.g. after hours of looking I am unable to determine how to convert a build that works perfectly well with Java EE XJC, but no idea what the related Jakarta artifacts are.

Specifically having trouble with

  • org.jvnet.jaxb2_commons:jaxb2-basics:0.12.0
  • org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.12.0

Though I've only gotten this far after hours of trying to track down how to achieve this in Jakarta EE.

@lukasj
Copy link
Contributor

lukasj commented Sep 20, 2021

have you tried https://github.com/highsource/jaxb2-basics ?

@sebersole
Copy link
Author

I have.

java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

@sebersole
Copy link
Author

Here are dependencies I have currently, which seems to be the closest but which leads to that above exception

    xjc 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1'
    xjc 'org.glassfish.jaxb:jaxb-runtime:3.0.1'
    xjc 'org.jvnet.jaxb2_commons:jaxb2-basics:1.11.1'
    xjc 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:1.11.1'
    xjc 'org.glassfish.jaxb:jaxb-xjc:3.0.2'

@lukasj
Copy link
Contributor

lukasj commented Sep 20, 2021

why

xjc 'org.glassfish.jaxb:jaxb-runtime:3.0.1'
xjc 'org.glassfish.jaxb:jaxb-xjc:3.0.2'

are not at the same version? I'm not saying that will help, just that it looks strange to me.

There are two things I'd check/try:

  • look at the dependency tree to see which exact version of the jaxb-xjc artifact is being used (this artifact has the same packages in javax (2.x) as well as in jakarta (3.x) versions)
  • try to add javax.xml.bind:jaxb-api:2.3.1 to your dependencies, that should resolve (hide?) the Error

@lukasj
Copy link
Contributor

lukasj commented Sep 20, 2021

note that jaxb2-basics (formerly jaxb2-commons project at java.net) has been community driven with no involvement of the jaxb(-ri) team since its beginning - if my memory works well after those ~15 years...

@sebersole
Copy link
Author

Just an oversight as I have been trying combinations. As you said, no difference.

I know its complicated, but its super frustrating to continually run into these kind of situations trying to migrate to Jakarta EE. Its not like jaxb2-basics is a super obscure, unused project.

@lukasj
Copy link
Contributor

lukasj commented Sep 20, 2021

I agree with you. We just have to deal with current situation somehow.... There is that Eclipse Transformer project, some similar alternative from Apache but I don't think they help in this case. An option could be to backport fix for eclipse-ee4j/jaxb-ri#1475 with reverted logic to 2.x version (EE8 branch) - add sth '-target 3.0' to generate 'jakarta'-ready code. The thing is that the code generated by plugins probably won't compile, so one would have to do some post-processing after running xjc. Just thinking loud...

@sebersole
Copy link
Author

I played around and got a working version of jaxb2-basics. Actually did not really even take much change.

highsource/jaxb2-basics#129

@cachescrubber
Copy link

cachescrubber commented May 25, 2022

Sorry when highjacking this issue, but there seems to be some expertise here about the topic.

I have projects which use the plugins from https://github.com/javaee/jaxb2-commons together with the Apache CXF XJC Plugin (https://github.com/apache/cxf-xjc-utils/tree/master/cxf-xjc-plugin). The later has been upgraded to JavaEE9 (Jakarta.*) recently. But the last commit in https://github.com/javaee/jaxb2-commons has is dated back to 2017. Is there any successor to this project which I have missed?

Update: The basics plugin in https://github.com/javaee/jaxb2-commons seems to be the predecessor of the Highsource https://github.com/highsource/jaxb2-basics plugin.

@cachescrubber
Copy link

I upgraded the other jaxb2-commons plugins in javaee/jaxb2-commons#46. Actually no big changes necessary besides the obvious dependency upgrades.

@laurentschoelens
Copy link
Contributor

Hi everyone
Currently working with Matt on updating highsource projects for jakarta migration
Also did get remaining old plugins into jaxb-basics (issue raised by @cachescrubber )

Keep updated, release will be soon available

@laurentschoelens
Copy link
Contributor

Hi everyone
Currently working with Matt on updating highsource projects for jakarta migration
Also did get remaining old plugins into jaxb-basics (issue raised by @cachescrubber )

Keep updated, release will be soon available

See highsource/jaxb2-basics#167 merged into master

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

No branches or pull requests

4 participants