You have to use maven-plugin-testing-harness 1.x for maven 2.x and
maven-plugin-testing-harness 2.x for maven 3.0.x. I think both 1.x and
2.x testing harness provide the same client API, so you maybe able to
run the same tests against different versions of maven, but I am not
certain about that.

--
Regards,
Igor

On 12-02-18 12:10 PM, kamesh.sampath wrote:
Hi,

I am developing a Mojo and trying to test it  using the
maven-plugin-testing-harness and i use Maven 3.0.x as my maven platform,

The following is the pom.xml snippet of my plugin where maven.version =
2.0.10

....



                <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-artifact</artifactId>
                        <version>${maven.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-model</artifactId>
                        <version>${maven.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-plugin-api</artifactId>
                        <version>${maven.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.maven</groupId>
                        <artifactId>maven-project</artifactId>
                        <version>${maven.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.maven.shared</groupId>
                        <artifactId>maven-invoker</artifactId>
                        <version>${maven.version}</version>
                </dependency>

.....

                <dependency>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-container-default</artifactId>
                        <version>1.5.5</version>
                        <scope>test</scope>
                </dependency>
                <dependency>
                        <groupId>org.apache.maven.plugin-testing</groupId>
                        <artifactId>maven-plugin-testing-harness</artifactId>
                        <version>2.0-alpha-1</version>
                        <scope>test</scope>
                </dependency>

When i execute the  test case i get the error as

java.lang.NoSuchMethodError:
org.codehaus.plexus.configuration.PlexusConfiguration.setName(Ljava/lang/String;)V
        at
org.codehaus.plexus.configuration.DefaultPlexusConfiguration.addChild(DefaultPlexusConfiguration.java:222)
        at
org.codehaus.plexus.configuration.DefaultPlexusConfiguration.getChild(DefaultPlexusConfiguration.java:165)
        at
org.codehaus.plexus.configuration.DefaultPlexusConfiguration.getChild(DefaultPlexusConfiguration.java:149)
        at
org.codehaus.plexus.container.initialization.InitializeComponentRegistryPhase.getComponentRepository(InitializeComponentRegistryPhase.java:66)
        at
org.codehaus.plexus.container.initialization.InitializeComponentRegistryPhase.execute(InitializeComponentRegistryPhase.java:41)
        at
org.codehaus.plexus.DefaultPlexusContainer.initializePhases(DefaultPlexusContainer.java:644)
        at
org.codehaus.plexus.DefaultPlexusContainer.initialize(DefaultPlexusContainer.java:556)
        at
org.codehaus.plexus.DefaultPlexusContainer.construct(DefaultPlexusContainer.java:281)
        at
org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:172)
        at
org.apache.maven.plugin.testing.AbstractMojoTestCase.setupContainer(AbstractMojoTestCase.java:128)
        at
org.apache.maven.plugin.testing.AbstractMojoTestCase.getContainer(AbstractMojoTestCase.java:141)
        at
org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:87)
.....

Not sure what is the cause of the issue , can someone help to fix this
pointing out what is wrong and how to fix this and test mojo with maven
3.0.3 and also ensure backward compatibility to a extent possible

~Kamesh

--
View this message in context: 
http://maven.40175.n5.nabble.com/Maven-Test-Harness-issue-tp5495578p5495578.html
Sent from the Maven Developers mailing list archive at Nabble.com.

---------------------------------------------------------------------
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