Skip to content

[MNG-8656] Maven cannot be embedded in applications that have upgraded Guice to 7.0+ #10435

@jira-importer

Description

@jira-importer

Basil Crow opened MNG-8656 and commented

With Java 17, install Jenkins 2.503, create a Maven installation for Maven 3.9.9, and create a Maven project building e.g. https://github.com/basil/simple-maven-project-with-tests. The job should succeed.

Now run the same job against jenkinsci/jenkins#8889 which upgrades Guice from 6.0 (which supports both javax.inject and jakarta.inject imports) to 7.0 (which only supports jakarta.inject imports). The job fails with:

java.lang.IllegalArgumentException: org.eclipse.sisu.Parameters is not a binding annotation. Please annotate it with @BindingAnnotation.
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:218)
    at com.google.inject.Key.ensureIsBindingAnnotation(Key.java:382)
    at com.google.inject.Key.strategyFor(Key.java:370)
    at com.google.inject.Key.get(Key.java:229)
    at org.eclipse.sisu.wire.ParameterKeys.<clinit>(ParameterKeys.java:28)
Caused: java.lang.ExceptionInInitializerError
    at org.eclipse.sisu.wire.DependencyAnalyzer.<init>(DependencyAnalyzer.java:93)
    at org.eclipse.sisu.wire.ElementAnalyzer.<init>(ElementAnalyzer.java:104)
    at org.eclipse.sisu.wire.WireModule.configure(WireModule.java:74)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:426)
    at com.google.inject.spi.Elements.getElements(Elements.java:113)
    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:160)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
    at com.google.inject.Guice.createInjector(Guice.java:87)
    at com.google.inject.Guice.createInjector(Guice.java:69)
    at com.google.inject.Guice.createInjector(Guice.java:59)
    at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:481)
    at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:206)
    at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:168)
    at hudson.maven.MavenEmbedderUtils.buildPlexusContainer(MavenEmbedderUtils.java:166)
    at hudson.maven.MavenEmbedderUtils.buildPlexusContainer(MavenEmbedderUtils.java:159)
    at hudson.maven.MavenEmbedder.<init>(MavenEmbedder.java:110)
    at hudson.maven.MavenEmbedder.<init>(MavenEmbedder.java:137)
    at hudson.maven.MavenUtil.createEmbedder(MavenUtil.java:211)
    at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1324)
    at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1124)
    at hudson.FilePath.act(FilePath.java:1236)
    at hudson.FilePath.act(FilePath.java:1219)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:985)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:689)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:526)
    at hudson.model.Run.execute(Run.java:1895)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
    at hudson.model.ResourceController.execute(ResourceController.java:101)
    at hudson.model.Executor.run(Executor.java:442)

This is blocking the Jenkins project from upgrading Guice from 6.0 to 7.0.

This problem was previously raised in MNG-8027, where it was suggested that Maven moving away from Guice may be a long-term direction that resolves this problem. As long the above symptom persists, the problem remains unresolved. Closing the ticket based on a future plan that has not yet been implemented does not eliminate the current problem. This ticket tracks the current problem—namely, that Maven cannot currently be embedded into an application running the latest version of Guice. It ought to be possible to embed Maven into any application with up-to-date dependencies; otherwise, Maven would be holding that application back. When Maven can be embedded into an application running up-to-date dependencies, this ticket can be closed—regardless of how that goal is achieved (e.g., Maven upgrading to Guice 7 or later, Maven upgrading to Guice 6.x and migrating from javax.inject to jakarta.inject, Maven moving away from Guice as described in MNG-8027, or another solution entirely).


Affects: 3.9.9

Issue Links:

  • MNG-8027 Maven cannot be embedded in applications that have upgraded Guice to 7.0+

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:majorMajor loss of function

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions