[MANT-69] use maven-plugin-tools' java 5 annotations
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1359723 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index 35693b2..53c9e9b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<parent>
<artifactId>maven-plugins</artifactId>
<groupId>org.apache.maven.plugins</groupId>
- <version>21</version>
+ <version>22</version>
<relativePath>../maven-plugins/pom.xml</relativePath>
</parent>
@@ -87,6 +87,11 @@
<version>${mavenVersion}</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>1.5.8</version>
@@ -140,6 +145,36 @@
</dependency>
</dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>mojo-descriptor</id>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
<profiles>
<profile>
<id>run-its</id>
diff --git a/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java b/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java
index 421b456..1ef9676 100644
--- a/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java
+++ b/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java
@@ -19,19 +19,22 @@
* under the License.
*/
-import java.io.File;
-
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.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import java.io.File;
+
/**
* Clean all Ant build files.
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @version $Id$
- * @goal clean
*/
+@Mojo( name = "clean" )
public class AntCleanMojo
extends AbstractMojo
{
@@ -45,22 +48,21 @@
/**
* The working project.
- *
- * @parameter default-value="${project}"
- * @required
- * @readonly
*/
+ @Component
private MavenProject project;
/**
* Forcing the deletion of the custom <code>build.xml</code>.
*
- * @parameter expression="${deleteCustomFiles}" default-value="false"
* @since 2.2
*/
+ @Parameter( property = "deleteCustomFiles", defaultValue = "false" )
private boolean deleteCustomFiles;
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void execute()
throws MojoExecutionException
{
@@ -76,9 +78,8 @@
}
else if ( getLog().isInfoEnabled() )
{
- getLog().info(
- "Not deleting custom " + buildXml.getName()
- + ", use -DdeleteCustomFiles=true to force its deletion" );
+ getLog().info( "Not deleting custom " + buildXml.getName() +
+ ", use -DdeleteCustomFiles=true to force its deletion" );
}
}
@@ -88,16 +89,14 @@
throw new MojoExecutionException( "Cannot delete " + mavenBuildXml.getAbsolutePath() );
}
- File mavenBuildProperties =
- new File( project.getBasedir(), AntBuildWriter.DEFAULT_MAVEN_PROPERTIES_FILENAME );
+ File mavenBuildProperties = new File( project.getBasedir(), AntBuildWriter.DEFAULT_MAVEN_PROPERTIES_FILENAME );
if ( mavenBuildProperties.exists() && !mavenBuildProperties.delete() )
{
throw new MojoExecutionException( "Cannot delete " + mavenBuildProperties.getAbsolutePath() );
}
- getLog().info(
- "Deleted Ant build files for project " + project.getArtifactId() + " in "
- + project.getBasedir().getAbsolutePath() );
+ getLog().info( "Deleted Ant build files for project " + project.getArtifactId() + " in " +
+ project.getBasedir().getAbsolutePath() );
}
}
diff --git a/src/main/java/org/apache/maven/plugin/ant/AntMojo.java b/src/main/java/org/apache/maven/plugin/ant/AntMojo.java
index 0190d23..907a8d1 100644
--- a/src/main/java/org/apache/maven/plugin/ant/AntMojo.java
+++ b/src/main/java/org/apache/maven/plugin/ant/AntMojo.java
@@ -25,6 +25,10 @@
import org.apache.maven.execution.MavenSession;
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.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;
@@ -37,10 +41,9 @@
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
- * @goal ant
- * @requiresDependencyResolution test
* @todo change this to use the artifact ant tasks instead of :get
*/
+@Mojo( name = "ant", requiresDependencyResolution = ResolutionScope.TEST )
public class AntMojo
extends AbstractMojo
{
@@ -50,16 +53,14 @@
/**
* Used for resolving artifacts.
- *
- * @component
*/
+ @Component
private ArtifactResolver resolver;
/**
* Factory for creating artifact objects.
- *
- * @component
*/
+ @Component
private ArtifactFactory factory;
// ----------------------------------------------------------------------
@@ -68,52 +69,38 @@
/**
* The project to create a build for.
- *
- * @parameter default-value="${project}"
- * @required
- * @readonly
*/
+ @Component
private MavenProject project;
/**
* The local repository where the artifacts are located.
- *
- * @parameter default-value="${localRepository}"
- * @required
- * @readonly
*/
+ @Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
private ArtifactRepository localRepository;
/**
* The remote repositories where artifacts are located.
- *
- * @parameter default-value="${project.remoteArtifactRepositories}"
- * @readonly
*/
+ @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true )
private List remoteRepositories;
/**
* The current user system settings for use in Maven.
- *
- * @parameter default-value="${settings}"
- * @required
- * @readonly
*/
+ @Component
private Settings settings;
/**
* Whether or not to overwrite the <code>build.xml</code> file.
- *
- * @parameter expression="${overwrite}" default-value="false"
*/
+ @Parameter( property = "overwrite", defaultValue = "false" )
private boolean overwrite;
/**
* The current Maven session.
- *
- * @parameter default-value="${session}"
- * @readonly
*/
+ @Component
private MavenSession session;
/** {@inheritDoc} */