o Fix a couple of typos.
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@630001 13f79535-47bb-0310-9956-ffa450edef68master
parent
5dd0756562
commit
db8dfe8978
|
|
@ -106,7 +106,8 @@ public class MyArtifactStub
|
|||
* @param version
|
||||
* @param packaging
|
||||
*/
|
||||
public ProjectInfoPluginArtifactStub( String groupId, String artifactId, String version, String packaging )
|
||||
public ProjectInfoPluginArtifactStub( String groupId, String artifactId,
|
||||
String version, String packaging )
|
||||
{
|
||||
this.groupId = groupId;
|
||||
this.artifactId = artifactId;
|
||||
|
|
@ -204,7 +205,8 @@ public class MyProjectStub
|
|||
{
|
||||
...
|
||||
|
||||
Artifact artifact = new MyArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging() );
|
||||
Artifact artifact = new MyArtifactStub( getGroupId(), getArtifactId(),
|
||||
getVersion(), getPackaging() );
|
||||
artifact.setArtifactHandler( new MyArtifactHandlerStub() );
|
||||
setArtifact( artifact );
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
Testing Complex Mojo Parameters
|
||||
|
||||
<<Note>>: This example improves the {{{../getting-started/index.html}cookbook}} for complex Mojo parameters testing.
|
||||
<<Note>>: This example improves the {{{../getting-started/index.html}cookbook}} for testing complex Mojo parameters.
|
||||
|
||||
In a real plugin development, you will use specific Maven objects like <<<MavenProject>>>, <<<localRepository>>> or
|
||||
In real plugin development, you will use specific Maven objects like <<<MavenProject>>>, <<<ArtifactRepository>>> or
|
||||
<<<MavenSettings>>>. You could use them by defining stubs.
|
||||
|
||||
Suppose that you have the following dependencies in the maven-my-plugin pom:
|
||||
|
|
@ -90,7 +90,7 @@ public class MyMojo
|
|||
|
||||
* Create Stubs
|
||||
|
||||
You need to create stubs objects to run <<<MyMojoTest#testSomething()>>>. By convention, the package name should
|
||||
You need to create stub objects to run <<<MyMojoTest#testSomething()>>>. By convention, the package name should
|
||||
reflect the stubs, i.e. in our case <<<org.apache.maven.plugin.my.stubs>>>.
|
||||
|
||||
-----
|
||||
|
|
@ -159,7 +159,7 @@ public class SettingsStub
|
|||
}
|
||||
-----
|
||||
|
||||
* Configuring <<<project-to-test>>> pom
|
||||
* Configure <<<project-to-test>>> pom
|
||||
|
||||
-----
|
||||
<project>
|
||||
|
|
@ -169,10 +169,10 @@ public class SettingsStub
|
|||
<plugin>
|
||||
<artifactId>maven-my-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Specify where this pom will be outputted files -->
|
||||
<!-- Specify where this pom will output files -->
|
||||
<outputDirectory>target/test-harness/project-to-test</outputDirectory>
|
||||
|
||||
<!-- By default <<<${basedir}/target/local-repo", where basedir refer
|
||||
<!-- By default <<<${basedir}/target/local-repo", where basedir refers
|
||||
to the basedir of maven-my-plugin. -->
|
||||
<localRepository>${localRepository}</localRepository>
|
||||
<!-- The defined stubs -->
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class MyMojo
|
|||
}
|
||||
------
|
||||
|
||||
To test a Mojo in a multiproject area, you need to define several stubs, i.e. for the main test project and his modules.
|
||||
To test a Mojo in a multiproject area, you need to define several stubs, i.e. for the main test project and its modules.
|
||||
|
||||
* Create Stubs
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ public class SubProject2Stub
|
|||
}
|
||||
-----
|
||||
|
||||
* Configuring <<<project-to-test>>> pom
|
||||
* Configure <<<project-to-test>>> pom
|
||||
|
||||
-----
|
||||
<project>
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@
|
|||
|
||||
Testing Using Repositories
|
||||
|
||||
<<Note>>: This example improves the {{{../getting-started/index.html}cookbook}} for repositories testing.
|
||||
<<Note>>: This example improves the {{{../getting-started/index.html}cookbook}} for testing repositories.
|
||||
|
||||
Developing Maven plugin needs often to have to play with repositories. Suppose that the MyMojo needs
|
||||
to download artifacts in your local repository, i.e.:
|
||||
When developing a Maven plugin you often need to play with repositories. Suppose that the MyMojo needs
|
||||
to download artifacts into your local repository, i.e.:
|
||||
|
||||
-----
|
||||
public class MyMojo
|
||||
|
|
@ -108,7 +108,7 @@ public class MyProjectStub
|
|||
}
|
||||
-----
|
||||
|
||||
* Configuring <<<project-to-test>>> pom
|
||||
* Configure <<<project-to-test>>> pom
|
||||
|
||||
-----
|
||||
<project>
|
||||
|
|
@ -118,10 +118,10 @@ public class MyProjectStub
|
|||
<plugin>
|
||||
<artifactId>maven-my-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Specify where this pom will be outputted files -->
|
||||
<!-- Specify where this pom will output files -->
|
||||
<outputDirectory>${basedir}/target/test-harness/project-to-test</outputDirectory>
|
||||
|
||||
<!-- By default <<<${basedir}/target/local-repo", where basedir refer
|
||||
<!-- By default <<<${basedir}/target/local-repo", where basedir refers
|
||||
to the basedir of maven-my-plugin. -->
|
||||
<localRepository>${localRepository}</localRepository>
|
||||
<!-- The defined stub -->
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ Cookbook: How To Use Maven Plugin Testing Harness?
|
|||
|
||||
* Prerequisites
|
||||
|
||||
We suppose that you had already created a plugin. In this cookbook, we make reference on <<<MyMojo>>> from
|
||||
We assume that you have already created a plugin. In this cookbook, we make reference to <<<MyMojo>>> in
|
||||
<<<maven-my-plugin>>> which is generated by the Maven Archetype Plugin, i.e.:
|
||||
|
||||
-----
|
||||
|
|
@ -58,9 +58,9 @@ maven-my-plugin
|
|||
|
||||
* Recipe
|
||||
|
||||
** Added <<<maven-plugin-testing-harness>>> dependency
|
||||
** Add <<<maven-plugin-testing-harness>>> dependency
|
||||
|
||||
As usually, just add <<<maven-plugin-testing-harness>>> as following in your pom. Be sure to specify <<<test>>> scope.
|
||||
As usual, just add <<<maven-plugin-testing-harness>>> as following in your pom. Be sure to specify <<<test>>> scope.
|
||||
|
||||
-----
|
||||
<project>
|
||||
|
|
@ -80,7 +80,7 @@ maven-my-plugin
|
|||
** Create a <<<MyMojoTest>>>
|
||||
|
||||
Create a <<<MyMojoTest>>> (by convention) class in <<<src/test/java/org/apache/maven/plugin/my>>> directory.
|
||||
This class should extends <<<AbstractMojoTestCase>>> from <<<maven-plugin-testing-harness>>>.
|
||||
This class should extend <<<AbstractMojoTestCase>>> from <<<maven-plugin-testing-harness>>>.
|
||||
|
||||
-----
|
||||
public class MyMojoTest
|
||||
|
|
@ -131,7 +131,7 @@ public class MyMojoTest
|
|||
|
||||
** Configuring <<<project-to-test>>> pom
|
||||
|
||||
Just create a pom as usual. The names for groupId and artifactId don't really care since this project will not be deployed.
|
||||
Just create a pom as usual. The names for groupId and artifactId don't really matter since this project will not be deployed.
|
||||
|
||||
-----
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
|
|
@ -181,6 +181,6 @@ mvn test
|
|||
|
||||
[[1]] {{{http://maven.apache.org/guides/plugin/guide-java-plugin-development.html}Guide to Developing Java Plugins}}
|
||||
|
||||
[[2]] {{{http://maven.apache.org/guides/mini/guide-configuring-plugins.html}Guide to Configuring Plug-ins}}
|
||||
[[2]] {{{http://maven.apache.org/guides/mini/guide-configuring-plugins.html}Guide to Configuring Plugins}}
|
||||
|
||||
[]
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
Maven Plugin Testing Mechanism
|
||||
|
||||
The Maven Plugin Testing Harness provides mechanisms to manage tests on Mojo, i.e. by pre-constructing the
|
||||
The Maven Plugin Testing Harness provides mechanisms to manage tests on Mojos, i.e. by pre-constructing the
|
||||
{{{http://plexus.codehaus.org}Plexus}} components, providing stub objects for Maven functionality such as projects,
|
||||
and populating fields from an XML file that resembles the Plugin configuration in the POM.
|
||||
and populating fields from an XML file that resembles the plugin configuration in the POM.
|
||||
|
||||
The best way to start is to read the cookbook {{{getting-started/index.html}How to use Maven Plugin Testing Harness}}.
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ under the License.
|
|||
<i>TestCase</i>.</dd>
|
||||
<dt>TestCase from Plexus</dt>
|
||||
<dd>Mojos are written to take specific advantage of the <a href="http://plexus.codehaus.org/">Plexus</a>
|
||||
container. If you need Plexus container services, you could write your class wich extends <i>PlexusTestCase</i>,
|
||||
container. If you need Plexus container services, you could write your class which extends <i>PlexusTestCase</i>,
|
||||
instead of <i>TestCase</i>.</dd>
|
||||
<dt>TestCase from Testing Harness</dt>
|
||||
<dd>If you need to inject Maven objects into your mojo, you could use the <i>maven-plugin-testing-harness</i>.
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<body>
|
||||
<menu name="Overview">
|
||||
<item name="Introduction" href="index.html"/>
|
||||
<item name="Getting Start" href="/getting-started/index.html"/>
|
||||
<item name="Getting Started" href="/getting-started/index.html"/>
|
||||
<item name="FAQ" href="/faq.html"/>
|
||||
</menu>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue