[ 
https://issues.apache.org/jira/browse/MNG-8656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17939378#comment-17939378
 ] 

Guillaume Nodet commented on MNG-8656:
--------------------------------------

The changes you propose are major incompatible changes.  This would break all 
plugins and extensions. So this would have to be scheduled for a major version 
of Maven.  The next one is Maven 4 and will phase out {{javax.inject}} in 
favour of {{org.apache.maven.api.di}} annotations.  Fwiw, it won't be complete 
in Maven 4, as there will be a transition period during which existing plugins 
will continue to work.  The migration will be complete in Maven 5.

> Maven cannot be embedded in applications that have upgraded Guice to 7.0+
> -------------------------------------------------------------------------
>
>                 Key: MNG-8656
>                 URL: https://issues.apache.org/jira/browse/MNG-8656
>             Project: Maven
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.9.9
>            Reporter: Basil Crow
>            Priority: Major
>
> 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 https://github.com/jenkinsci/jenkins/pull/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:
> {noformat}
> 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)
> {noformat}
> 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-8028, or 
> another solution entirely).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to