'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. to jakarta...
The libraries included in gradle are:
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. library. If I include javax. libraries:
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
I get java.lang.NoClassDefFoundError errors.
Is there a way to have compatibility with the old libraries?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | user7610 |