Skip to content

Add jakarta support through bytecode transformation #157

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

luckpoint
Copy link

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 performJakartaTransformation and transformJarToJakarta Gradle tasks
    • Added Jakarta-specific dependency configurations with jakarta.servlet-api:5.0.0
  • Test Coverage:

    • Added JakartaCompatibilityTest.java to verify Jakarta EE servlet API compatibility
    • Implemented comprehensive tests for HttpServletRequest, HttpServletResponse, HttpSession, and Cookie Jakarta classes
    • Added testJakarta task to run Jakarta-specific tests with transformed bytecode
  • Distribution:

    • Generates dual JAR artifacts: standard and Jakarta-compatible (with jakarta classifier)
    • Maintains backward compatibility with existing javax.servlet-based applications
    • Supports Tomcat 10+ and other Jakarta EE 9+ application servers
  • 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:

  • JakartaCompatibilityTest class 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

Testing

This change has been thoroughly tested to ensure compatibility across both servlet environments:

  • This change adds test coverage

    • Added JakartaCompatibilityTest with comprehensive Jakarta servlet API tests
    • Tests verify HttpServletRequest, HttpServletResponse, HttpSession, and Cookie functionality
    • Integration tests confirm transformed bytecode works with Jakarta dependencies
  • 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:

Checklist

luckpoint added 3 commits June 3, 2025 19:55
…Eclipse Transformer - Add Eclipse Transformer integration to generate jakarta-compatible JAR - Publish both javax and jakarta versions with classifier - Update build configuration for dual artifact generation - Add Jakarta test source set for compatibility testing - Update README with installation instructions for both environments - Bump version to 1.12.0
* Implement Jakarta servlet API tests
@luckpoint luckpoint requested a review from a team as a code owner June 3, 2025 13:56
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

Successfully merging this pull request may close these issues.

2 participants