You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by tc...@apache.org on 2012/07/10 17:17:13 UTC
svn commit: r1359723 - in /maven/plugins/trunk/maven-ant-plugin: pom.xml
src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java
src/main/java/org/apache/maven/plugin/ant/AntMojo.java
Author: tchemit
Date: Tue Jul 10 15:17:13 2012
New Revision: 1359723
URL: http://svn.apache.org/viewvc?rev=1359723&view=rev
Log:
[MANT-69] use maven-plugin-tools' java 5 annotations
Modified:
maven/plugins/trunk/maven-ant-plugin/pom.xml
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntMojo.java
Modified: maven/plugins/trunk/maven-ant-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/pom.xml?rev=1359723&r1=1359722&r2=1359723&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-ant-plugin/pom.xml Tue Jul 10 15:17:13 2012
@@ -25,7 +25,7 @@ under the License.
<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 @@ under the License.
<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 @@ under the License.
</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>
Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java?rev=1359723&r1=1359722&r2=1359723&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java Tue Jul 10 15:17:13 2012
@@ -19,19 +19,22 @@ package org.apache.maven.plugin.ant;
* 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 @@ public class AntCleanMojo
/**
* 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 @@ public class AntCleanMojo
}
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 @@ public class AntCleanMojo
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() );
}
}
Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntMojo.java?rev=1359723&r1=1359722&r2=1359723&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntMojo.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntMojo.java Tue Jul 10 15:17:13 2012
@@ -25,6 +25,10 @@ import org.apache.maven.artifact.resolve
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 @@ import java.util.Properties;
*
* @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 @@ public class AntMojo
/**
* Used for resolving artifacts.
- *
- * @component
*/
+ @Component
private ArtifactResolver resolver;
/**
* Factory for creating artifact objects.
- *
- * @component
*/
+ @Component
private ArtifactFactory factory;
// ----------------------------------------------------------------------
@@ -68,52 +69,38 @@ public class AntMojo
/**
* 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} */