question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

micronaut-core still has transitive dependency on findbugs:jsr305 (com.google.code.findbugs:jsr305:3.0.2)

See original GitHub issue

As of Micronaut 2.1, there is still a transitive dependency on findbugs:jsr305

+--- io.micronaut:micronaut-inject:2.1.1
     +--- org.slf4j:slf4j-api:1.7.26 -> 1.7.30
     +--- javax.annotation:javax.annotation-api:1.3.2
     +--- javax.inject:javax.inject:1
     +--- io.micronaut:micronaut-core:2.1.1
     |    +--- org.slf4j:slf4j-api:1.7.26 -> 1.7.30
     |    +--- org.reactivestreams:reactive-streams:1.0.3
     |    \--- com.github.spotbugs:spotbugs-annotations:4.0.3
     |         \--- com.google.code.findbugs:jsr305:3.0.2
     \--- org.yaml:snakeyaml:1.26

The transitive dependency results in Java Module System split-package issues:

error: the unnamed module reads package javax.annotation from both java.annotation and jsr305
error: module io.micronaut.core reads package javax.annotation from both jsr305 and java.annotation
error: module javafx.controlsEmpty reads package javax.annotation from both jsr305 and java.annotation
error: module javafx.graphicsEmpty reads package javax.annotation from both jsr305 and java.annotation
error: module javafx.baseEmpty reads package javax.annotation from both jsr305 and java.annotation
error: module java.annotation reads package javax.annotation from both jsr305 and java.annotation
error: module org.yaml.snakeyaml reads package javax.annotation from both jsr305 and java.annotation
error: module org.reactivestreams reads package javax.annotation from both jsr305 and java.annotation
error: module com.github.spotbugs.annotations reads package javax.annotation from both jsr305 and java.annotation
error: module jsr305 reads package javax.annotation from both jsr305 and java.annotation
error: module io.micronaut.inject reads package javax.annotation from both jsr305 and java.annotation
error: module org.slf4j reads package javax.annotation from both jsr305 and java.annotation
error: module javax.inject reads package javax.annotation from both jsr305 and java.annotation

I work around this with the Java Modularity Gradle Modules Plugin as follows:

patchModules.config = [
        "java.annotation=jsr305-3.0.2.jar"
]

Note that the documentation is incorrect and says

The JSR-305 annotations library (com.google.code.findbugs:jsr305) is no longer a dependency (replaced by spotbugs-annotations). If you need this library you will need to add it manually.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
graemerochercommented, Feb 13, 2021

@aalmiray Micronaut 2.4 will let you exclude spot bugs using dependency exclusions to solve this issue

1reaction
msgilligancommented, Mar 10, 2021

I’m also seeing 2 beans that are correctly loaded when I use javax.inject.Singleton but not when I use jakarta.inject.SIngleton (simply changing javax to jakarta in the import statement causes the bean not to load). Other beans are working with jakarta, so I’m not sure what is happening. I’ll investigate further when I have time and post details.

NOTE: I am using Micronaut Application Gradle Plugin v1.4.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error:Conflict with dependency 'com.google.code.findbugs ...
Enforces Gradle to only compile the version number you state for all dependencies, no matter which version number the dependencies have stated. Share....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found