Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6210

can't load @SessionScoped/@MojoExecutionScoped components from .mvn/extensions.xml

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.1, 3.3.3, 3.3.9
    • Fix Version/s: 3.5.2
    • Component/s: Class Loading
    • Labels:
      None

      Description

      The build fails with the exception below if Maven core extensions defined in .mvn/extensions.xml includes any @SessionScoped or MojoExecutionScoped components

      [WARNING] ClassRealm[coreExtension>io.takari.maven:takari-workspace-reader:0.3.31-SNAPSHOT, parent: ClassRealm[plexus.core, parent: null]]
      com.google.inject.CreationException: Unable to create injector, see the following errors:
      
      1) No scope is bound to org.apache.maven.SessionScoped.
        at io.takari.maven.workspace.GenerationsWorkspaceReader.class(Unknown Source)
        at ClassRealm[coreExtension>io.takari.maven:takari-workspace-reader:0.3.31-SNAPSHOT, parent: ClassRealm[plexus.core, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
      
      1 error
      	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466)
      	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
      	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
      	at com.google.inject.Guice.createInjector(Guice.java:96)
      	at com.google.inject.Guice.createInjector(Guice.java:73)
      	at com.google.inject.Guice.createInjector(Guice.java:62)
      	at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:481)
      	at org.codehaus.plexus.DefaultPlexusContainer.discoverComponents(DefaultPlexusContainer.java:460)
      	at org.codehaus.plexus.DefaultPlexusContainer.discoverComponents(DefaultPlexusContainer.java:435)
      	at org.apache.maven.cli.MavenCli.container(MavenCli.java:568)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:287)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:205)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      
      

        Activity

        Show
        igorf Igor Fedorenko added a comment - Proposed fix: https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commit;h=30644f05c7be0e390b139c58a1159a2131dec74c Integration test: https://git-wip-us.apache.org/repos/asf?p=maven-integration-testing.git;a=commit;h=66f162a4bd4daea1c86c1bda328b63484bed53de
        Hide
        igorf Igor Fedorenko added a comment -

        fixed in master

        Show
        igorf Igor Fedorenko added a comment - fixed in master
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build maven-3.x #1644 (See https://builds.apache.org/job/maven-3.x/1644/)
        MNG-6210 allow maven custom guice scopes in .mvn/extensions (ifedorenko: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=c2c6259de6f1262d9b31509b8c30844a386a4f29)

        • (edit) maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1644 (See https://builds.apache.org/job/maven-3.x/1644/ ) MNG-6210 allow maven custom guice scopes in .mvn/extensions (ifedorenko: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=c2c6259de6f1262d9b31509b8c30844a386a4f29 ) (edit) maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
        Hide
        michael-o Michael Osipov added a comment -

        The IT breaks Git Bash:

        mosipov@mikaw10 MINGW64 /d/Entwicklung/Projekte/maven-integration-testing (master)
        $ git pull
        Updating 03e63dc..39a910a
        error: cannot stat 'core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/src/main/java/org/apache/maven/its/core_extensions_custom_scopes/TestMojoExecutionScopedComponent.java': Filename too long
        error: cannot stat 'core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/src/main/java/org/apache/maven/its/core_extensions_custom_scopes/TestSessionScopedComponent.java': Filename too long
        error: The following untracked working tree files would be overwritten by merge:
                core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6209MultipleBuildExtensions.java
                core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6210CoreExtensionsCustomScopesTest.java
                core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-a/pom.xml
                core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-a/src/main/java/org/apache/maven/its/mng6209/multiple/build/extensions/plugina/BuildExtensionAComponent.java
                core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-a/src/main/java/org/apache/maven/its/mng6209/multiple/build/extensions/plugina/BuildExtensionAMojo.java
                core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-b/pom.xml
                core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-b/src/main/java/org/apache/maven/its/mng6209/multiple/build/extensions/pluginb/BuildExtensionBMojo.java
                core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/project/pom.xml
                core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/client/.mvn/extensions.xml
                core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/client/pom.xml
                core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/.gitignore
                core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/pom.xml
                core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/src/main/resources/META-INF/maven/extension.xml
                core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-plugin-core-extensions-custom-scopes-client/.gitignore
                core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-plugin-core-extensions-custom-scopes-client/pom.xml
        Please move or remove them before you can merge.
        Aborting
        

        You should shorten it down.

        Show
        michael-o Michael Osipov added a comment - The IT breaks Git Bash: mosipov@mikaw10 MINGW64 /d/Entwicklung/Projekte/maven-integration-testing (master) $ git pull Updating 03e63dc..39a910a error: cannot stat 'core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/src/main/java/org/apache/maven/its/core_extensions_custom_scopes/TestMojoExecutionScopedComponent.java': Filename too long error: cannot stat 'core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/src/main/java/org/apache/maven/its/core_extensions_custom_scopes/TestSessionScopedComponent.java': Filename too long error: The following untracked working tree files would be overwritten by merge: core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6209MultipleBuildExtensions.java core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6210CoreExtensionsCustomScopesTest.java core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-a/pom.xml core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-a/src/main/java/org/apache/maven/its/mng6209/multiple/build/extensions/plugina/BuildExtensionAComponent.java core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-a/src/main/java/org/apache/maven/its/mng6209/multiple/build/extensions/plugina/BuildExtensionAMojo.java core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-b/pom.xml core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/plugin-b/src/main/java/org/apache/maven/its/mng6209/multiple/build/extensions/pluginb/BuildExtensionBMojo.java core-it-suite/src/test/resources/mng-6209-multiple-build-extensions/project/pom.xml core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/client/.mvn/extensions.xml core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/client/pom.xml core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/.gitignore core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/pom.xml core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-core-extensions-custom-scopes/src/main/resources/META-INF/maven/extension.xml core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-plugin-core-extensions-custom-scopes-client/.gitignore core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-plugin-core-extensions-custom-scopes-client/pom.xml Please move or remove them before you can merge. Aborting You should shorten it down.
        Hide
        igorf Igor Fedorenko added a comment -

        What is "git bash"? If this is windows/cygwin, I don't have access to a system where I can test this and don't want to make blind changes. Do you think you can rename the test projects to work in your environment and I'll be happy to review and merge your changes.

        Show
        igorf Igor Fedorenko added a comment - What is "git bash"? If this is windows/cygwin, I don't have access to a system where I can test this and don't want to make blind changes. Do you think you can rename the test projects to work in your environment and I'll be happy to review and merge your changes.
        Hide
        michael-o Michael Osipov added a comment -

        Yes, Git for Windows. You just need to shorten the paths and Git will be happy.

        Show
        michael-o Michael Osipov added a comment - Yes, Git for Windows. You just need to shorten the paths and Git will be happy.
        Hide
        igorf Igor Fedorenko added a comment -

        The problem is, I have no way to test if the shortened paths are short enough or not.

        Show
        igorf Igor Fedorenko added a comment - The problem is, I have no way to test if the shortened paths are short enough or not.
        Hide
        michael-o Michael Osipov added a comment -

        I think it will be fine if you cut it down to 150 chars. Leaves enough space for user-supplied path.

        Show
        michael-o Michael Osipov added a comment - I think it will be fine if you cut it down to 150 chars. Leaves enough space for user-supplied path.
        Hide
        michael-o Michael Osipov added a comment -

        Still not working. Cloning of the repo is still broken. Please fix otherwise I will revert the commit and put it into a branch.

        Show
        michael-o Michael Osipov added a comment - Still not working. Cloning of the repo is still broken. Please fix otherwise I will revert the commit and put it into a branch.
        Hide
        igorf Igor Fedorenko added a comment -

        I've shortened the test project file names some, if you still can't clone the repo I suggest using shorter local path, something like "/d/work/maven-its". I also suggest you add MINGW64 build to Apache Maven Jenkins, which is really the only way to guarantee MINGW64 does not regress in the future.

        https://git1-us-west.apache.org/repos/asf?p=maven-integration-testing.git;a=commit;h=a9857509453b42ad9b26fad80d5c421de0a2c50e

        Show
        igorf Igor Fedorenko added a comment - I've shortened the test project file names some, if you still can't clone the repo I suggest using shorter local path, something like "/d/work/maven-its". I also suggest you add MINGW64 build to Apache Maven Jenkins, which is really the only way to guarantee MINGW64 does not regress in the future. https://git1-us-west.apache.org/repos/asf?p=maven-integration-testing.git;a=commit;h=a9857509453b42ad9b26fad80d5c421de0a2c50e
        Hide
        michael-o Michael Osipov added a comment -

        Looks way better now, but these are still too long:

        error: unable to create file core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-plugin-core-extensions-custom-scopes-client/src/main/java/org/apache/maven/its/core_extensions_custom_scopes/plugin/ValidateMojoExecutionScopedMojo.java: Filename too long
        error: unable to create file core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-plugin-core-extensions-custom-scopes-client/src/main/java/org/apache/maven/its/core_extensions_custom_scopes/plugin/ValidateSessionScopedMojo.java: Filename too long
        error: unable to create file core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo/org/apache/maven/its/it-core-extensions-custom-scopes/maven-it-plugin-core-extensions-custom-scopes-client/0.1/maven-it-plugin-core-extensions-custom-scopes-client-0.1.jar: Filename too long
        error: unable to create file core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo/org/apache/maven/its/it-core-extensions-custom-scopes/maven-it-plugin-core-extensions-custom-scopes-client/0.1/maven-it-plugin-core-extensions-custom-scopes-client-0.1.pom: Filename too long
        

        they are longer than 240 chars. Leaving virtually no room for a short local path.

        Show
        michael-o Michael Osipov added a comment - Looks way better now, but these are still too long: error: unable to create file core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-plugin-core-extensions-custom-scopes-client/src/main/java/org/apache/maven/its/core_extensions_custom_scopes/plugin/ValidateMojoExecutionScopedMojo.java: Filename too long error: unable to create file core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo-src/maven-it-plugin-core-extensions-custom-scopes-client/src/main/java/org/apache/maven/its/core_extensions_custom_scopes/plugin/ValidateSessionScopedMojo.java: Filename too long error: unable to create file core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo/org/apache/maven/its/it-core-extensions-custom-scopes/maven-it-plugin-core-extensions-custom-scopes-client/0.1/maven-it-plugin-core-extensions-custom-scopes-client-0.1.jar: Filename too long error: unable to create file core-it-suite/src/test/resources/mng-6210-core-extensions-custom-scopes/repo/org/apache/maven/its/it-core-extensions-custom-scopes/maven-it-plugin-core-extensions-custom-scopes-client/0.1/maven-it-plugin-core-extensions-custom-scopes-client-0.1.pom: Filename too long they are longer than 240 chars. Leaving virtually no room for a short local path.
        Show
        igorf Igor Fedorenko added a comment - These files don't exist in the git repository https://git1-us-west.apache.org/repos/asf?p=maven-integration-testing.git;a=tree;f=core-it-suite/src/test/resources;h=ee55a631383994f02c25f1e67190b6c937297def;hb=HEAD .
        Hide
        michael-o Michael Osipov added a comment -

        Works flawlessly now. Thanks for the fix.

        Show
        michael-o Michael Osipov added a comment - Works flawlessly now. Thanks for the fix.

          People

          • Assignee:
            igorf Igor Fedorenko
            Reporter:
            igorf Igor Fedorenko
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development