From a4ba9593bb39f783d12f25f363f2534fc8aa8feb Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 7 May 2012 15:40:20 +0000 Subject: [PATCH] improve it git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/branches/MPLUGIN-189@1335070 13f79535-47bb-0310-9956-ffa450edef68 --- maven-plugin-plugin/pom.xml | 2 +- .../invoker.properties | 1 + .../src/it/annotation-with-inheritance/pom.xml | 5 +++++ .../apache/maven/plugin/coreit/FirstMojo.java | 13 +++++++++---- .../main/resources/META-INF/maven/lifecycle.xml | 17 +++++++++++++++++ .../annotation-with-inheritance/verify.groovy | 2 +- 6 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/resources/META-INF/maven/lifecycle.xml diff --git a/maven-plugin-plugin/pom.xml b/maven-plugin-plugin/pom.xml index b16b644..6a4111a 100644 --- a/maven-plugin-plugin/pom.xml +++ b/maven-plugin-plugin/pom.xml @@ -59,9 +59,9 @@ - 2.0.6 1.2 1.2 + 2.0.6 true diff --git a/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties b/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties index 26b6a75..71b5b1c 100644 --- a/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties +++ b/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties @@ -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 diff --git a/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml b/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml index 9901100..d14442c 100644 --- a/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml +++ b/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml @@ -44,6 +44,11 @@ under the License. maven-plugin-api 2.0 + + org.apache.maven + maven-project + @mavenVersion@ + org.apache.maven.plugin-tools maven-plugin-annotations diff --git a/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java b/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java index 564b97a..dde40db 100644 --- a/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java +++ b/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java @@ -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" ); + } } } diff --git a/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/resources/META-INF/maven/lifecycle.xml b/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/resources/META-INF/maven/lifecycle.xml new file mode 100644 index 0000000..62d944b --- /dev/null +++ b/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/resources/META-INF/maven/lifecycle.xml @@ -0,0 +1,17 @@ + + + cobertura + + + process-classes + + + test + + ${project.build.directory}/generated-classes/cobertura + true + + + + + \ No newline at end of file diff --git a/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy b/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy index ef33aa5..32a3d3b 100644 --- a/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy +++ b/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy @@ -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