Hi Jochen,

I don't think you need to include the goalPrefix ("xml") when you lookup the mojo in your test case
when you use the testing harness.

It should be:

ValidatorMojo vm = (ValidatorMojo) lookupMojo( "validate", testPom );


Thanks,
Odea


Jochen Wiedmann wrote:

Hi,

I am attempting to write a plugin test by using the
maven-plugin-testing-harness. I have created the following test-POM and am
trying to invoke it through

 File testPom = new File( getBasedir(), "src/test/it1/pom.xml" );
 ValidatorMojo vm = (ValidatorMojo) lookupMojo( "xml:validate", testPom );
 vm.execute();

But I receive an 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-xml-plugin:0.0.1:xml:validate.

with org.apache.maven.plugins being my group Id, maven-xml-plugin being my
artifactId, and 0.0.1 being my version number. According to plugin.xml my
goalPrefix is "xml" and my goal is "validate", so "xml:validate" should be
fine. Any ideas, what might be wrong?

Thanks,

Jochen



<?xml version="1.0" encoding="UTF-8"?>
<project>
 <modelVersion>4.0.0</modelVersion>
 <groupId>org.apache.maven.plugins.xml</groupId>
 <artifactId>it1</artifactId>
 <version>0.0.1</version>
 <name>Maven XML Plugin IT 1</name>
 <description>Integration Test 1 for the Maven XML Plugin</description>
 <build>
   <plugins>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-xml-plugin</artifactId>
       <version>0.0.1</version>
       <configuration>
         <docType>
           <dir>xml</dir>
         </docType>
       </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