Skip to content
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

Migrate to Jakarta EE namespace #402

Open
nscuro opened this issue Jun 22, 2022 · 3 comments · May be fixed by #570
Open

Migrate to Jakarta EE namespace #402

nscuro opened this issue Jun 22, 2022 · 3 comments · May be fixed by #570

Comments

@nscuro
Copy link
Collaborator

nscuro commented Jun 22, 2022

The current stack is based on:

  • Java EE (javax.servlet.* namespace)
  • Jersey 2.x
  • Jetty 9.x

Community support for Jetty 9.x has ended as of June 1st 2022. There will still be security patches, but it's a good indicator that we should look into updating it. Jetty 11, the latest major release of Jetty, does not support legacy Java EE APIs anymore and is based on the new Jakarta EE APIs instead.

The move to Jakarta requires an upgrade of Jersey to 3.x (migration guide here).

I'm sure there are more dependencies and breaking changes that will pop up once work on this is started.

@nscuro
Copy link
Collaborator Author

nscuro commented Jun 13, 2023

Some additional notes:

  1. OpenRewrite has a recipe for the migration to Jakarta EE 9: https://docs.openrewrite.org/recipes/java/migrate/jakarta/javaxmigrationtojakarta. I tested it already and it works great, both for the Alpine and Dependency-Track codebase.
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:LATEST \
  -Drewrite.activeRecipes=org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta
  1. swagger-core 1.x does not support Jakarta. We have to upgrade to 2.x, which also changes the OpenAPI spec from 2.x to 3.x. This means we have an implicit dependency on Add support for OpenAPI 3.0 #1. Lots of annotations have changed, causing increased manual refactoring effort, especially on the Dependency-Track side.

@nscuro
Copy link
Collaborator Author

nscuro commented Jun 15, 2023

@stevespringett What is your current opinion on how to deal with Alpine's OpenAPI integration?

  • As mentioned above, updating the Swagger library is a precondition for moving forward with the Jakarta migration
    • Updating swagger-core will cause significant refactoring efforts in DT due to all the annotation changes
  • Migrate Swagger to OpenAPI 3 DependencyTrack/dependency-track#840 states that auto-generated OpenAPI docs should be removed altogether from Alpine and DT, and switching to manually-maintained OpenAPI docs instead

Should we upgrade swagger-core, or should we drop it completely from Alpine?

I propose to:

  1. Remove Swagger / OpenAPI from Alpine entirely (would this require a Alpine v3 release?)
  2. Export the current auto-generated Swagger doc from DT
  3. Remove all Swagger annotations from DT
  4. Serve exported swagger.json in DT via static file servlet

In a next step, we can start working on DependencyTrack/dependency-track#840:

  • As this will be a larger task, we can ship the new OpenAPI v3 manifest in addition to the legacy Swagger v2 file
    • e.g. /api/swagger.json and /api/openapi-v3.yaml
  • OpenAPI v3 manifest will be worked on iteratively until it covers the entire API surface
  • Once coverage reaches 100%, remove legacy swagger.json

Thoughts?

@stevespringett
Copy link
Owner

That sounds like a solid approach. We will eventually need to determine, possibly through a PR check, of modifications made to a resource which do not include modifications to the api docs. Keeping the api docs in sync with the code may be a challenge, but at least we'll have accurate docs at some point.

Alpine v3 sounds good to me.

nscuro added a commit to nscuro/Alpine that referenced this issue Dec 3, 2023
Tried using logback 1.3.x, but that requires SLF4j 2.x which then caused the DataNucleus Maven plugin to fail.

logback 1.4.x cannot be used until we migrate to Jakarta EE, which is tracked in stevespringett#402.

logback 1.2.x is still supported and received its last update on Dec 1st. I updated the dependabot config to only suggest new bugfix versions.

Signed-off-by: nscuro <nscuro@protonmail.com>
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 a pull request may close this issue.

2 participants