improve it

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/branches/MPLUGIN-189@1335070 13f79535-47bb-0310-9956-ffa450edef68
master
Olivier Lamy 2012-05-07 15:40:20 +00:00
parent ccc0c36afe
commit a4ba9593bb
6 changed files with 34 additions and 6 deletions

View File

@ -59,9 +59,9 @@
</distributionManagement>
<properties>
<mavenVersion>2.0.6</mavenVersion>
<doxiaVersion>1.2</doxiaVersion>
<doxia-sitetoolsVersion>1.2</doxia-sitetoolsVersion>
<mavenVersion>2.0.6</mavenVersion>
<it.debug>true</it.debug>
</properties>

View File

@ -1,5 +1,6 @@
invoker.goals.1 = install
invoker.goals.2 = org.apache.maven.its.annotation-with-inheritance:annotation-with-inheritance:1.0:it0014
invoker.goals.3 = org.apache.maven.its.annotation-with-inheritance:annotation-with-inheritance:1.0:first
#FIXME disabled need to find a solution for the chicken and eggs issue.
#help sources are generated @generated-sources but need descriptor which need compile phase first for classes scanning
#invoker.goals.3 = org.apache.maven.its.basic-java-annotations:maven-it-basic-java-annotations:1.0::help

View File

@ -44,6 +44,11 @@ under the License.
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>@mavenVersion@</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>

View File

@ -19,7 +19,6 @@ package org.apache.maven.plugin.coreit;
* under the License.
*/
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Execute;
@ -27,8 +26,6 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import java.io.File;
/**
* Touches a test file.
*
@ -48,12 +45,20 @@ public class FirstMojo
@Parameter( alias = "alias" )
private String aliasedParam;
@Component( role = "org.apache.maven.project.MavenProjectHelper", roleHint = "test" )
@Component( role = "org.apache.maven.project.MavenProjectHelper", roleHint = "default" )
private Object projectHelper;
public void execute()
throws MojoExecutionException
{
if ( projectHelper == null )
{
throw new MojoExecutionException( "projectHelper == null" );
}
if (basedir == null || touchFile == null)
{
throw new MojoExecutionException( "basedir == null || touchFile == null" );
}
}
}

View File

@ -0,0 +1,17 @@
<lifecycles>
<lifecycle>
<id>cobertura</id>
<phases>
<phase>
<id>process-classes</id>
</phase>
<phase>
<id>test</id>
<configuration>
<classesDirectory>${project.build.directory}/generated-classes/cobertura</classesDirectory>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</phase>
</phases>
</lifecycle>
</lifecycles>

View File

@ -35,7 +35,7 @@ assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.dire
assert mojo.requirements.requirement.size() == 1
assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.project.MavenProjectHelper'
assert mojo.requirements.requirement[0].'role-hint'.text() == 'test'
assert mojo.requirements.requirement[0].'role-hint'.text() == 'default'
assert mojo.requirements.requirement[0].'field-name'.text() == 'projectHelper'
assert mojo.parameters.parameter.size() == 3