xvik / dropwizard-guicey

Dropwizard guice integration
http://xvik.github.io/dropwizard-guicey/
MIT License
234 stars 49 forks source link

Replace `jakarta.` with `javax.` for Dropwizard 3.x #359

Closed pbelousov closed 11 months ago

pbelousov commented 11 months ago

Version 6.2.0 introduced a couple of jakarta imports that break applications at runtime.

xvik commented 11 months ago

Guice 6 works with both javax and jakarta annotations (and includes both dependencies)

Could you please describe:

  1. How you setup guicey (direct dependency or with BOM)?
  2. What build tool you use (maven or gradle)?

Most likely, in your project jakarta.inject 1.0.5 used instead of 2.0.1, but I want to understand how this could happen.

And, of course, I don't mind to fix direct jakarta inject usages, just need to understand first

pbelousov commented 11 months ago

Thank you for blazingly fast response!

How you setup guicey (direct dependency or with BOM)?

We have a direct dependency.

What build tool you use (maven or gradle)?

Maven

Most likely, in your project jakarta.inject 1.0.5 used instead of 2.0.1

That's absolutely correct, and that's because Dropwizard 3.x uses 1.0.5: https://github.com/dropwizard/dropwizard/blob/v3.0.0/dropwizard-dependencies/pom.xml#L42C33-L42C33

xvik commented 11 months ago

Thank you for clarification! I see now, its all because of dropwizard BOM forcing this version.

In guicey BOM I'm forcing correct version to override dropwizard default.

As a quick fix you can force jakarta.inject-api 2.0.1 the same way (just override version in dependencyManagement). This would be completely legal as dropwizard use jakarta 1.0 as a replacement for javax artifact, but guice brings in javax.inject:javax.inject and so all javax annotations would be present in classpath.

I will deal with pr a bit later (to avoid such problems). But I would like to wait a bit with release as new dropwizard version could be released soon.

xvik commented 10 months ago

released