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

Guice dependency in conflict with some other plugin Guice #47

Open
nemecec opened this issue Dec 17, 2019 · 0 comments
Open

Guice dependency in conflict with some other plugin Guice #47

nemecec opened this issue Dec 17, 2019 · 0 comments

Comments

@nemecec
Copy link

nemecec commented Dec 17, 2019

I added gradle-jaxb-plugin to my project and the build started failing with:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.google.inject.internal.Annotations
        at com.google.inject.Key.ensureRetainedAtRuntime(Key.java:362)
        at com.google.inject.Key.strategyFor(Key.java:339)
        at com.google.inject.Key.get(Key.java:274)
        at com.google.inject.assistedinject.FactoryModuleBuilder.implement(FactoryModuleBuilder.java:266)
        at com.google.inject.assistedinject.FactoryModuleBuilder.implement(FactoryModuleBuilder.java:250)
        at com.google.inject.assistedinject.FactoryModuleBuilder.implement(FactoryModuleBuilder.java:242)
        at com.google.inject.assistedinject.FactoryModuleBuilder$implement.call(Unknown Source)
        at org.openrepose.gradle.plugins.jaxb.schema.guice.DocSlurperModule.configure(DocSlurperModule.groovy:44)
        at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
        at com.google.inject.spi.Elements.getElements(Elements.java:103)
        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
        at com.google.inject.Guice.createInjector(Guice.java:94)
        at com.google.inject.Guice.createInjector(Guice.java:71)
        at com.google.inject.Guice$createInjector.call(Unknown Source)
        at org.openrepose.gradle.plugins.jaxb.JaxbPlugin.apply(JaxbPlugin.groovy:51)
        at org.openrepose.gradle.plugins.jaxb.JaxbPlugin.apply(JaxbPlugin.groovy)

The issue seems to be with the Guice library that is used by gradle-jaxb-plugin and ends up being pulled transitively into Gradle classpath (Gradle does not have separate classloaders for separate plugins).
Judging by the stack trace, it is in conflict with Sonatype sisu-guice-3.1.0 library which probably comes from some Maven plugin (as Sonatype is the company behind Maven).

Solution: shadow the Guice library, pull it into gradle-jaxb-plugin namespace.

nemecec pushed a commit to sympower/gradle-jaxb-plugin that referenced this issue Dec 17, 2019
…e can conflict with other Gradle plugins
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

No branches or pull requests

1 participant