Is it at all possible to use older Java EE libraries (with javax
package) in new Jakarta EE applications (with jakarta
package)?
All the APIs would be backwards compatible if it weren't for the trademark issue. Is there any runtime library or build tool available that can get them to work together? Is the only solution to fork old libraries and updated them manually?
I'm in particular looking at the Servlet API, but validation, persistence, webservices and mail may bite me too.
You can use the Eclipse Transformer project to transform your older Java EE compatible jar with javax.*
imports to a jar using jakarta.*
imports.
The transformer takes care of some additional things like renaming constants in configuration files and such. It's a work in progress, but does the job quite well already.
To quote the documentation:
Eclipse Transformer provides tools and runtime components that transform Java binaries, such as individual class files and complete JARs and WARs, mapping changes to Java packages, type names, and related resource names.
While the initial impetus for the project was the Jakarta EE package renaming issue, the scope of the project is broader to support other renaming scenarios. For example, shading.