Hi Jochen,

Did you check that you have the correct goal name when you looked up the mojo? :)
There seems to be nothing wrong with your configuration..

Thanks,
Odea

Jochen Wiedmann wrote:

Hi,

I am about to write a test case for MJAR-20. Below you find my unit test and
my pom. Unfortunately, when I try to execute the unit test, I receive the
following exception:

org.codehaus.plexus.component.repository.exception.ComponentLookupException:
Component descriptor cannot be found in the component repository:
org.apache.maven.plugin.Mojoorg.apache.maven.plugins:maven-jar-plugin:2.1-SNAPSHOT:test-jar.
        at
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:319)
        at
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:436)
        at org.codehaus.plexus.PlexusTestCase.lookup(PlexusTestCase.java:222)
        at
org.apache.maven.plugin.testing.AbstractMojoTestCase.lookupMojo(AbstractMojoTestCase.java:164)
        at
org.apache.maven.plugin.testing.AbstractMojoTestCase.lookupMojo(AbstractMojoTestCase.java:110)
        at
org.apache.maven.plugin.jar.TestJarMojoTest.testTestJarInPomProject(TestJarMojoTest.java:42)

Any ideas what might be wrong?

Thanks,

Jochen


Unit test:

   package org.apache.maven.plugin.jar;

   import java.io.File;

   import org.apache.maven.plugin.testing.AbstractMojoTestCase;

   public class TestJarMojoTest
       extends AbstractMojoTestCase
   {
       private File testPom = new File( getBasedir(),
                      "src/test/resources/test-jar-0/pom.xml" );

       protected void setUp()
           throws Exception
       {
           // required for mojo lookups to work
           super.setUp();
       }

       /**
        * Tests, whether a test-jar is created for a project with the pom
        * packaging.
        */
       public void testTestJarInPomProject()
           throws Exception
       {
           TestJarMojo mojo = (TestJarMojo)
               lookupMojo( "test-jar", testPom   );
           mojo.execute();
       }
   }


POM:

   <project>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>jar-mjar-20</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
     <version>1.0</version>
     <packaging>pom</packaging>
     <name>Test Case for MJAR-20</name>
     <build>
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-jar-plugin</artifactId>
           <executions>
              <execution>
                 <goals>
                    <goal>test-jar</goal>
                 </goals>
              </execution>
           </executions>
           <configuration>
           </configuration>
         </plugin>
       </plugins>
     </build>
   </project>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to