-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
jetty-maven-plugin - maven internal dependencies included on webapp classloader #7677
Comments
You should try with a more recent version of Maven Core (3.8.4 should not have this problem anymore if still I can have a look at fixing it). By the way you should notice jsr 305 have been voted as dormant (so almost dead). |
@unb interesting. Could you share more about how you are starting and configuring your osgi container via the The I tend to agree that machinery from the plugin shouldn't leak into the webapp, however, as this is a |
@janbartel We don't use jsr305-3.0.2.jar. It's being pulled in by Maven. You can see it is a dependency of maven-core by running:
(replace $HOME/.m2/repository with wherever your maven repository is located) The workaround shown in the original post adds the dependency on maven-core so it can exclude js305. We embed the Atlassian Plugin Framework, which uses Apache Felix. What seems to be happening is that PackageScanner will (sometimes, rarely) determine that javax.annotation is version 3.0.2 (from jsr305-3.0.2.jar) rather than the 1.3.x provided by Jetty. |
@unb that jar ( |
@joakime & @olamy I can still see it on the classpath when running jetty under Maven 3.8.4. I also updated jetty to 9.4.45.v20220203
|
Obviously maven-core itself will show that dependency. What about your project? |
I guess this change in jetty-10.0.x might help you #7626 |
@joakime It doesn't show up in a @olamy Thanks - I'll try it out later. In the meantime, I'll just exclude it from the classpath. |
@unb do you have a simple project we could use to reproduce? |
@olamy Not as yet. I will try and produce one in the next day or so. |
The zip jetty-7677.zip demonstrates the issue. It produces a listing of all of the jars available to the servlet when launched by To use, download and:
If com.google.code.findbugs:jsr305 is present, it will be shown as jsr305-3.0.2.jar |
Signed-off-by: Jan Bartel <[email protected]>
* Issue #7677 Exclude findbugs jsr305 jar from plugin Signed-off-by: Jan Bartel <[email protected]> * add IT test for those classes exclusions Signed-off-by: Olivier Lamy <[email protected]>
Fixed via #7682 |
Jetty version(s)
9.4.38.v20210224
Maven version
3.6.3
Description
When using maven to run a webapp using jetty:run some of the maven's internal dependencies are included on the classpath used to launch the jetty-maven-plugin.
This includes jsr305-3.0.2.jar (com.google.code.findbugs:jsr305), depended on by org.apache.maven:maven-core.
This jar includes a javax.annotation package, which is problematic for our embedded OSGi support as it conflicts with the javax.annotation package provided by Jetty.
It would be good if either:
The workaround is to manually exclude jsr305 by manipulating the jetty-maven-plugins dependencies.
This is a little brittle as it needs to be updated each time jetty-maven-plugin is updated:
How to reproduce?
Easiest approach is to attach a debugger to a webapp launched using jetty:run and try load one of the classes included by jsr305. E.g.:
When using the exclusion shown above, these classes are no longer available and the calls throw ClassNotFoundException
The text was updated successfully, but these errors were encountered: