简体   繁体   English

旧的 javax 库与雅加达的兼容性

[英]Old javax libraries compatibility with jakarta

I updated my java project with the latest Java JDK and Tomcat 10. The new libraries use jakarta and you need to rename all your javax.我用最新的 Java JDK 和 Tomcat 10 更新了我的 java 项目。 to jakarta...到雅加达...

The libraries included in gradle are: gradle包含的库有:

compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '5.0.0'
compileOnly group: 'jakarta.servlet.jsp', name: 'jakarta.servlet.jsp-api', version: '3.0.0'
compileOnly group: 'jakarta.el', name: 'jakarta.el-api', version: '4.0.0'
compileOnly group: 'jakarta.websocket', name: 'jakarta.websocket-api', version: '2.0.0'
compileOnly group: 'jakarta.security.enterprise', name: 'jakarta.security.enterprise-api', version: '2.0.0'
implementation group: 'jakarta.servlet.jsp.jstl', name: 'jakarta.servlet.jsp.jstl-api', version: '2.0.0'
implementation group: 'org.glassfish.web', name: 'jakarta.servlet.jsp.jstl', version: '2.0.0'

But I found I couldnt use Sitemesh and Htmlcompressor libraries anymore because they use old javax.但我发现我不能再使用 Sitemesh 和 Htmlcompressor 库,因为它们使用旧的 javax。 library.图书馆。 If I include javax.如果我包含 javax. libraries:图书馆:

compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'

I get java.lang.NoClassDefFoundError errors.我收到 java.lang.NoClassDefFoundError 错误。

Is there a way to have compatibility with the old libraries?有没有办法与旧库兼容?

Include both the old and the new libraries?包括旧库和新库? Since there are two different namespaces, they might be able to live together.由于有两个不同的命名空间,它们可能可以共存。 If it works, it should be enough as a transitory solution before everybody migrates to jakarta.如果可行,在每个人迁移到雅加达之前,它作为一个临时解决方案就足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM