Author: olamy Date: Thu Aug 2 21:01:53 2012 New Revision: 1368704 URL: http://svn.apache.org/viewvc?rev=1368704&view=rev Log: [MARCHETYPES-40] Use new annotations with Plugin Archetype.
Modified: maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/pom.xml maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyMojo.java maven/archetypes/trunk/maven-archetype-plugin/src/test/resources/projects/basic/verify.groovy Modified: maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/pom.xml?rev=1368704&r1=1368703&r2=1368704&view=diff ============================================================================== --- maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/pom.xml (original) +++ maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/pom.xml Thu Aug 2 21:01:53 2012 @@ -21,6 +21,16 @@ <version>2.0</version> </dependency> <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <version>3.1</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + <version>3.0.3</version> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> @@ -33,13 +43,20 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId> - <version>2.9</version> + <version>3.1</version> <configuration> <goalPrefix>${artifactId}</goalPrefix> + <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> </configuration> <executions> <execution> - <id>generated-helpmojo</id> + <id>mojo-descriptor</id> + <goals> + <goal>descriptor</goal> + </goals> + </execution> + <execution> + <id>help-goal</id> <goals> <goal>helpmojo</goal> </goals> Modified: maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyMojo.java URL: http://svn.apache.org/viewvc/maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyMojo.java?rev=1368704&r1=1368703&r2=1368704&view=diff ============================================================================== --- maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyMojo.java (original) +++ maven/archetypes/trunk/maven-archetype-plugin/src/main/resources/archetype-resources/src/main/java/MyMojo.java Thu Aug 2 21:01:53 2012 @@ -19,6 +19,11 @@ package $package; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; + import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -26,20 +31,16 @@ import java.io.IOException; /** * Goal which touches a timestamp file. * - * @goal touch - * - * @phase process-sources - * * @deprecated Don't use! */ +@Mojo(name="touch",defaultPhase = LifecyclePhase.PROCESS_SOURCES) public class MyMojo extends AbstractMojo { /** * Location of the file. - * @parameter default-value="${project.build.directory}" expression="${outputDir}" - * @required */ + @Parameter(defaultValue="${project.build.directory}",property="outputDir",required=true) private File outputDirectory; public void execute() Modified: maven/archetypes/trunk/maven-archetype-plugin/src/test/resources/projects/basic/verify.groovy URL: http://svn.apache.org/viewvc/maven/archetypes/trunk/maven-archetype-plugin/src/test/resources/projects/basic/verify.groovy?rev=1368704&r1=1368703&r2=1368704&view=diff ============================================================================== --- maven/archetypes/trunk/maven-archetype-plugin/src/test/resources/projects/basic/verify.groovy (original) +++ maven/archetypes/trunk/maven-archetype-plugin/src/test/resources/projects/basic/verify.groovy Thu Aug 2 21:01:53 2012 @@ -21,6 +21,7 @@ def parameter = mojo.parameters.paramete assert parameter.name.text() == 'outputDirectory' assert parameter.type.text() == 'java.io.File' +assert parameter.required.text() == 'true' assert parameter.description.text() == 'Location of the file.'