auth0-java-mvc-common
auth0-java-mvc-common copied to clipboard
Add jakarta support through bytecode transformation
Changes
This PR introduces comprehensive Jakarta EE support for the auth0-java-mvc-common library through Eclipse Transformer-based bytecode transformation. This enables the library to work seamlessly with both traditional Java EE (javax.servlet) and modern Jakarta EE (jakarta.servlet) environments without requiring separate codebases.
Key Changes:
-
Build System Enhancements:
- Added Jakarta test source set configuration (
src/testJakarta/) - Implemented Eclipse Transformer integration for automatic javax→jakarta package transformation
- Created
performJakartaTransformationandtransformJarToJakartaGradle tasks - Added Jakarta-specific dependency configurations with
jakarta.servlet-api:5.0.0
- Added Jakarta test source set configuration (
-
Test Coverage:
- Added
JakartaCompatibilityTest.javato verify Jakarta EE servlet API compatibility - Implemented comprehensive tests for
HttpServletRequest,HttpServletResponse,HttpSession, andCookieJakarta classes - Added
testJakartatask to run Jakarta-specific tests with transformed bytecode
- Added
-
Distribution:
- Generates dual JAR artifacts: standard and Jakarta-compatible (with
jakartaclassifier) - Maintains backward compatibility with existing javax.servlet-based applications
- Supports Tomcat 10+ and other Jakarta EE 9+ application servers
- Generates dual JAR artifacts: standard and Jakarta-compatible (with
-
Documentation:
- Updated README.md with Jakarta EE installation instructions for both Maven and Gradle
- Added clear distinction between javax.servlet and jakarta.servlet usage patterns
- Specified minimum version requirements (jakarta.servlet 5.0+)
Classes and Methods Added:
-
JakartaCompatibilityTestclass with Jakarta servlet API verification tests - Gradle tasks:
performJakartaTransformation,transformJarToJakarta,testJakarta - Jakarta source set configuration in
build.gradle
Endpoints/APIs:
- No public API changes - maintains full compatibility with existing codebase
- Jakarta version accessible via Maven/Gradle classifier:
mvc-auth-commons:1.12.0:jakarta
References
- Eclipse Transformer Project - Bytecode transformation tool for javax→jakarta migration
Testing
This change has been thoroughly tested to ensure compatibility across both servlet environments:
-
[x] This change adds test coverage
- Added
JakartaCompatibilityTestwith comprehensive Jakarta servlet API tests - Tests verify HttpServletRequest, HttpServletResponse, HttpSession, and Cookie functionality
- Integration tests confirm transformed bytecode works with Jakarta dependencies
- Added
-
[x] This change has been tested on the latest version of Java or why not
./gradlew testInJava-8 testInJava-11 testInJava-17 testInJava-21 --parallel
> Configure project :
Using version 1.12.0 for mvc-auth-commons group com.auth0
Test will be running in 8
Test will be running in 11
Test will be running in 17
Test will be running in 21
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 2s
7 actionable tasks: 7 up-to-date
Manual Testing:
- Deploy to Tomcat 10+ with Jakarta classifier dependency
- https://github.com/luckpoint/auth0-servlet-sample/tree/feat/jakarta-package
Checklist
- [x] I have read the Auth0 general contribution guidelines
- [x] I have read the Auth0 Code of Conduct
- [x] All existing and new tests complete without errors