Maven 2 & 3
  1. Maven 2 & 3
  2. MNG-2831

Cannot add custom artifact handler and custom lifecycle as a build extension

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5
    • Fix Version/s: 2.0.7
    • Component/s: General
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      I have an extension registering a custom artifact handler and a custom lifecycle against plexus. The project that uses that extension get the following error:

      [DEBUG] Error looking up lifecycle mapping to retrieve optional mojos. Lifecycle ID: clean. Error: Component descriptor cannot be found in the component repository: org.apache.maven.lifecycle.mapping.LifecycleMappingxar.
      org.codehaus.plexus.component.repository.exception.ComponentLookupException: Component descriptor cannot be found in the component repository: org.apache.maven.lifecycle.mapping.LifecycleMappingxar.
              at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:323)
              at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
              at org.apache.maven.execution.MavenSession.lookup(MavenSession.java:123)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.findOptionalMojosForLifecycle(DefaultLifecycleExecutor.java:1111)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindLifecycleForPackaging(DefaultLifecycleExecutor.java:999)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:980)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
              at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
              at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
              at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      [DEBUG] Skipping disabled repository codehaus.plugin.snapshots
      [DEBUG] Skipping disabled repository apache.snapshots
      [DEBUG] maven-clean-plugin: resolved to version 2.1 from repository central
      [DEBUG] Retrieving parent-POM: org.apache.maven.plugins:maven-plugin-parent::2.0 for project: null:maven-clean-plugin:maven-plugin:2.1 from the repository.
      [DEBUG] org.apache.maven.plugins:maven-clean-plugin:maven-plugin:2.1:runtime (selected for runtime)
      [DEBUG]   org.apache.maven:maven-plugin-api:jar:2.0:runtime (selected for runtime)
      [DEBUG] Retrieving parent-POM: org.apache.maven.shared:shared-components-parent::1 for project: null:file-management:jar:1.0 from the repository.
      [DEBUG]   org.apache.maven.shared:file-management:jar:1.0:runtime (selected for runtime)
      [DEBUG]     org.codehaus.plexus:plexus-utils:jar:1.0.4:runtime (selected for runtime)
      [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-clean-plugin:2.1:clean' -->
      [DEBUG]   (f) directory = /Users/vmassol/dev/maven/trunks/core-integration-testing/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/target
      [DEBUG]   (f) outputDirectory = /Users/vmassol/dev/maven/trunks/core-integration-testing/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/target/classes
      [DEBUG]   (f) testOutputDirectory = /Users/vmassol/dev/maven/trunks/core-integration-testing/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/target/test-classes
      [DEBUG] -- end configuration --
      [INFO] [clean:clean]
      [INFO] Deleting directory /Users/vmassol/dev/maven/trunks/core-integration-testing/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/target
      [DEBUG] Found deletable paths: []
      [INFO] Deleting directory /Users/vmassol/dev/maven/trunks/core-integration-testing/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/target/classes
      [DEBUG] Found deletable paths: []
      [INFO] Deleting directory /Users/vmassol/dev/maven/trunks/core-integration-testing/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/target/test-classes
      [DEBUG] Found deletable paths: []
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Cannot find lifecycle mapping for packaging: 'xar'.
      Component descriptor cannot be found in the component repository: org.apache.maven.lifecycle.mapping.LifecycleMappingxar.
      [INFO] ------------------------------------------------------------------------
      [DEBUG] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Cannot find lifecycle mapping for packaging: 'xar'.
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.findMappingsForLifecycle(DefaultLifecycleExecutor.java:1071)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindLifecycleForPackaging(DefaultLifecycleExecutor.java:997)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:980)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
              at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
              at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
              at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Component descriptor cannot be found in the component repository: org.apache.maven.lifecycle.mapping.LifecycleMappingxar.
              at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:323)
              at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
              at org.apache.maven.execution.MavenSession.lookup(MavenSession.java:123)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.findMappingsForLifecycle(DefaultLifecycleExecutor.java:1064)
              ... 17 more
      

      I have created an it0115 test in /trunks/core-integration-testing/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle to reproduce the problem.

        Issue Links

          Activity

          Hide
          Vincent Massol added a comment -

          Assigning to 2.0.6 as requested by Jason

          Show
          Vincent Massol added a comment - Assigning to 2.0.6 as requested by Jason
          Hide
          Jason van Zyl added a comment -

          Vincent, the extension that you have for your test must have a packaging = maven-plugin. Once this is done the test you created works and an XAR is created. Can you try this and see if the result is what you wanted?

          Show
          Jason van Zyl added a comment - Vincent, the extension that you have for your test must have a packaging = maven-plugin. Once this is done the test you created works and an XAR is created. Can you try this and see if the result is what you wanted?
          Hide
          Jason van Zyl added a comment -

          Vincent I updated your integration test if you want to take a look.

          Show
          Jason van Zyl added a comment - Vincent I updated your integration test if you want to take a look.
          Hide
          Jason van Zyl added a comment -

          Vincent I'm writing in IT for the test project and are you just looking for the XAR file being created?

          Show
          Jason van Zyl added a comment - Vincent I'm writing in IT for the test project and are you just looking for the XAR file being created?
          Hide
          Jason van Zyl added a comment -

          Integration test checked in, and it appears the XAR is produced and is intact.

          Show
          Jason van Zyl added a comment - Integration test checked in, and it appears the XAR is produced and is intact.
          Hide
          Vincent Massol added a comment -

          Jason, this is not working for me... I had "maven-plugin" set in my pom (I did forget to use it in the IT though). Thus if the IT works now it means I haven't reproduced the problem I had in my POM.

          Here it is:

          <?xml version="1.0" encoding="UTF-8"?>
          
          <project>
            <modelVersion>4.0.0</modelVersion>
            <parent>
              <groupId>com.xpn.xwiki</groupId>
              <artifactId>xwiki-build-tools</artifactId>
              <version>1.0-SNAPSHOT</version>
            </parent>
            <artifactId>xwiki-build-xar-handlers</artifactId>
            <name>XWiki Tools - Build - XAR Handlers</name>
            <packaging>maven-plugin</packaging>
            <description>XWiki Build Tools - XAR Handlers (Lifecycle and ArtifactHandler)</description>
            <scm>
              <connection>scm:svn:svn://svn.forge.objectweb.org/svnroot/xwiki/xwiki-tools/build-tools/build-xar-handlers</connection>
              <developerConnection>scm:svn:svn+ssh://svn.forge.objectweb.org/svnroot/xwiki/xwiki-tools/build-tools/build-xar-handlers</developerConnection>
              <url>http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki-tools/build-tools/build-xar-handlers</url>
            </scm>
            <dependencies>
              <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-plugin-api</artifactId>
                <version>2.0</version>
                </dependency>
              <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-archiver</artifactId>
                <version>2.2</version>
              </dependency>
              <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-utils</artifactId>
                <version>1.4</version>
              </dependency>
              <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-artifact</artifactId>
                <version>2.0</version>
              </dependency>
            </dependencies>
          </project>
          
          Show
          Vincent Massol added a comment - Jason, this is not working for me... I had "maven-plugin" set in my pom (I did forget to use it in the IT though). Thus if the IT works now it means I haven't reproduced the problem I had in my POM. Here it is: <?xml version= "1.0" encoding= "UTF-8" ?> <project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.xpn.xwiki</groupId> <artifactId>xwiki-build-tools</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>xwiki-build-xar-handlers</artifactId> <name>XWiki Tools - Build - XAR Handlers</name> <packaging>maven-plugin</packaging> <description>XWiki Build Tools - XAR Handlers (Lifecycle and ArtifactHandler)</description> <scm> <connection>scm:svn:svn: //svn.forge.objectweb.org/svnroot/xwiki/xwiki-tools/build-tools/build-xar-handlers</connection> <developerConnection>scm:svn:svn+ssh: //svn.forge.objectweb.org/svnroot/xwiki/xwiki-tools/build-tools/build-xar-handlers</developerConnection> <url>http: //svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki-tools/build-tools/build-xar-handlers</url> </scm> <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> <version>2.0</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-archiver</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-artifact</artifactId> <version>2.0</version> </dependency> </dependencies> </project>
          Hide
          Vincent Massol added a comment -

          Jason, I'm reopening as I don't believe it's fixed. I've tried it0115 with 2.0.6-SNAPSHOT from trunk and it's failing. The trick is that it works if you build BOTH the extension and the project in the same reactor run. If you run first the extension and THEN the project you'll see it fail.

          Show
          Vincent Massol added a comment - Jason, I'm reopening as I don't believe it's fixed. I've tried it0115 with 2.0.6-SNAPSHOT from trunk and it's failing. The trick is that it works if you build BOTH the extension and the project in the same reactor run. If you run first the extension and THEN the project you'll see it fail.
          Hide
          Jason van Zyl added a comment -

          Did you run the integration test? As there is no reactor in the IT, the projects are being run separately and not in a reactor and it passes.

          Show
          Jason van Zyl added a comment - Did you run the integration test? As there is no reactor in the IT, the projects are being run separately and not in a reactor and it passes.
          Hide
          Vincent Massol added a comment -

          What I did:

          $ cd it0115-customArtifactHandlerAndCustomLifecycle/
          $ cd test-extension/
          $ mvn install
          $ cd ../test-project/
          $ mvn install <--- fails
          

          The error is:

          [INFO] ----------------------------------------------------------------------------
          [INFO] Building Test Project
          [INFO]    task-segment: [install]
          [INFO] ----------------------------------------------------------------------------
          [INFO] ------------------------------------------------------------------------
          [ERROR] BUILD ERROR
          [INFO] ------------------------------------------------------------------------
          [INFO] Cannot find lifecycle mapping for packaging: 'xar'.
          Component descriptor cannot be found in the component repository: org.apache.maven.lifecycle.mapping.LifecycleMappingxar.
          

          Are you able to reproduce this?

          Show
          Vincent Massol added a comment - What I did: $ cd it0115-customArtifactHandlerAndCustomLifecycle/ $ cd test-extension/ $ mvn install $ cd ../test-project/ $ mvn install <--- fails The error is: [INFO] ---------------------------------------------------------------------------- [INFO] Building Test Project [INFO] task-segment: [install] [INFO] ---------------------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Cannot find lifecycle mapping for packaging: 'xar'. Component descriptor cannot be found in the component repository: org.apache.maven.lifecycle.mapping.LifecycleMappingxar. Are you able to reproduce this?
          Hide
          Jason van Zyl added a comment -

          I was actually using 2.1 after looking at my logs. So it works on trunk, not with 2.0.6.

          Show
          Jason van Zyl added a comment - I was actually using 2.1 after looking at my logs. So it works on trunk, not with 2.0.6.
          Hide
          Jason van Zyl added a comment -

          This now works on trunk, so we'll have to look at this for 2.0.7.

          Show
          Jason van Zyl added a comment - This now works on trunk, so we'll have to look at this for 2.0.7.
          Hide
          Jason van Zyl added a comment -

          This does not work currently on the branch. I'm not sure anyone other then Vincent is using this as it is a custom packaging along with an artifact handler. I'm not sure this is critical for 2.0.7.

          Show
          Jason van Zyl added a comment - This does not work currently on the branch. I'm not sure anyone other then Vincent is using this as it is a custom packaging along with an artifact handler. I'm not sure this is critical for 2.0.7.
          Hide
          Brett Porter added a comment -

          I'd say it's a priority for 2.0.x only if it's a regression against an earlier 2.0.x, and there is no workaround.

          I guess this could be closed for 2.1-alpha-1, and if we do fix it for 2.0.7 change the version?

          Show
          Brett Porter added a comment - I'd say it's a priority for 2.0.x only if it's a regression against an earlier 2.0.x, and there is no workaround. I guess this could be closed for 2.1-alpha-1, and if we do fix it for 2.0.7 change the version?
          Hide
          Vincent Massol added a comment -

          FYI it is a regression from earlier. It used to work in 2.0.4 or 2.0.5.

          Show
          Vincent Massol added a comment - FYI it is a regression from earlier. It used to work in 2.0.4 or 2.0.5.
          Hide
          Jason van Zyl added a comment -

          Then it's somethign that we'll need to fix for 2.0.7. I'm sure this is a result of changing how the extension manager worked. The fix version is 2.0.7.

          Show
          Jason van Zyl added a comment - Then it's somethign that we'll need to fix for 2.0.7. I'm sure this is a result of changing how the extension manager worked. The fix version is 2.0.7.
          Hide
          Jason van Zyl added a comment -

          Just running the ITs against a fix to make sure everything is ok, and then I think this one is licked.

          Show
          Jason van Zyl added a comment - Just running the ITs against a fix to make sure everything is ok, and then I think this one is licked.

            People

            • Assignee:
              Jason van Zyl
              Reporter:
              Vincent Massol
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: