You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/06/28 15:51:24 UTC
svn commit: r1355014 - in /maven/plugins/trunk/maven-install-plugin: ./
src/main/java/org/apache/maven/plugin/install/
Author: olamy
Date: Thu Jun 28 13:51:23 2012
New Revision: 1355014
URL: http://svn.apache.org/viewvc?rev=1355014&view=rev
Log:
[MINSTALL-88] use maven-plugin-tools' java 5 annotations
Patch modified to use non snapshot version
Submitted by Tony Chemit.
Modified:
maven/plugins/trunk/maven-install-plugin/pom.xml
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
Modified: maven/plugins/trunk/maven-install-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/pom.xml?rev=1355014&r1=1355013&r2=1355014&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-install-plugin/pom.xml Thu Jun 28 13:51:23 2012
@@ -53,6 +53,7 @@ under the License.
<properties>
<mavenVersion>2.0.6</mavenVersion>
+ <mavenPluginPluginVersion>3.0</mavenPluginPluginVersion>
</properties>
<dependencies>
@@ -81,6 +82,15 @@ under the License.
<artifactId>maven-artifact</artifactId>
<version>${mavenVersion}</version>
</dependency>
+
+ <!-- dependencies to annotations -->
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>${mavenPluginPluginVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
@@ -99,6 +109,47 @@ under the License.
</dependency>
</dependencies>
+ <build>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>${mavenPluginPluginVersion}</version>
+ <configuration>
+ <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+ </configuration>
+ <executions>
+ <execution>
+ <id>mojo-descriptor</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>help-goal</id>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>${mavenPluginPluginVersion}</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
<profiles>
<profile>
<id>run-its</id>
Modified: maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java?rev=1355014&r1=1355013&r2=1355014&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java Thu Jun 28 13:51:23 2012
@@ -26,6 +26,8 @@ import org.apache.maven.artifact.metadat
import org.apache.maven.artifact.repository.ArtifactRepository;
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.Parameter;
import org.codehaus.plexus.digest.Digester;
import org.codehaus.plexus.digest.DigesterException;
import org.codehaus.plexus.util.FileUtils;
@@ -46,49 +48,44 @@ public abstract class AbstractInstallMoj
{
/**
- * @component
*/
+ @Component
protected ArtifactFactory artifactFactory;
/**
- * @component
*/
+ @Component
protected ArtifactInstaller installer;
/**
- * @parameter expression="${localRepository}"
- * @required
- * @readonly
*/
+ @Parameter( property = "localRepository", required = true, readonly = true )
protected ArtifactRepository localRepository;
/**
* Flag whether to create checksums (MD5, SHA-1) or not.
*
- * @parameter expression="${createChecksum}" default-value="false"
* @since 2.2
*/
+ @Parameter( property = "createChecksum", defaultValue = "false" )
protected boolean createChecksum;
/**
* Whether to update the metadata to make the artifact a release version.
- *
- * @parameter expression="${updateReleaseInfo}" default-value="false"
*/
+ @Parameter( property = "updateReleaseInfo", defaultValue = "false" )
protected boolean updateReleaseInfo;
/**
* Digester for MD5.
- *
- * @component role-hint="md5"
*/
+ @Component( hint = "md5" )
protected Digester md5Digester;
/**
* Digester for SHA-1.
- *
- * @component role-hint="sha1"
*/
+ @Component( hint = "sha1" )
protected Digester sha1Digester;
/**
Modified: maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=1355014&r1=1355013&r2=1355014&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java Thu Jun 28 13:51:23 2012
@@ -30,6 +30,9 @@ import org.apache.maven.model.io.xpp3.Ma
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+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.artifact.ProjectArtifactMetadata;
import org.apache.maven.project.validation.ModelValidationResult;
import org.apache.maven.project.validation.ModelValidator;
@@ -53,125 +56,113 @@ import java.util.Map;
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
- * @goal install-file
- * @requiresProject false
- * @aggregator
- * @threadSafe
*/
+@Mojo( name = "install-file", requiresProject = false, aggregator = true, threadSafe = true )
public class InstallFileMojo
extends AbstractInstallMojo
{
/**
* GroupId of the artifact to be installed. Retrieved from POM file if one is specified.
- *
- * @parameter expression="${groupId}"
*/
+ @Parameter( property = "groupId" )
protected String groupId;
/**
* ArtifactId of the artifact to be installed. Retrieved from POM file if one is specified.
- *
- * @parameter expression="${artifactId}"
*/
+ @Parameter( property = "artifactId" )
protected String artifactId;
/**
* Version of the artifact to be installed. Retrieved from POM file if one is specified.
- *
- * @parameter expression="${version}"
*/
+ @Parameter( property = "version" )
protected String version;
/**
* Packaging type of the artifact to be installed. Retrieved from POM file if one is specified.
- *
- * @parameter expression="${packaging}"
*/
+ @Parameter( property = "packaging" )
protected String packaging;
/**
* Classifier type of the artifact to be installed. For example, "sources" or "javadoc". Defaults to none which
* means this is the project's main artifact.
*
- * @parameter expression="${classifier}"
* @since 2.2
*/
+ @Parameter( property = "classifier" )
protected String classifier;
/**
* The file to be installed in the local repository.
- *
- * @parameter expression="${file}"
- * @required
*/
+ @Parameter( property = "file", required = true )
private File file;
/**
* The bundled API docs for the artifact.
*
- * @parameter expression="${javadoc}"
* @since 2.3
*/
+ @Parameter( property = "javadoc" )
private File javadoc;
/**
* The bundled sources for the artifact.
*
- * @parameter expression="${sources}"
* @since 2.3
*/
+ @Parameter( property = "sources" )
private File sources;
/**
* Location of an existing POM file to be installed alongside the main artifact, given by the {@link #file}
* parameter.
*
- * @parameter expression="${pomFile}"
* @since 2.1
*/
+ @Parameter( property = "pomFile" )
private File pomFile;
/**
* Generate a minimal POM for the artifact if none is supplied via the parameter {@link #pomFile}. Defaults to
* <code>true</code> if there is no existing POM in the local repository yet.
*
- * @parameter expression="${generatePom}"
* @since 2.1
*/
+ @Parameter( property = "generatePom" )
private Boolean generatePom;
/**
* The type of remote repository layout to install to. Try <code>legacy</code> for a Maven 1.x-style repository
* layout.
*
- * @parameter expression="${repositoryLayout}" default-value="default"
- * @required
* @since 2.2
*/
+ @Parameter( property = "repositoryLayout", defaultValue = "default", required = true )
private String repositoryLayout;
/**
* Map that contains the repository layouts.
- *
- * @component role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
*/
+ @Component( role = ArtifactRepositoryLayout.class )
private Map repositoryLayouts;
/**
* The path for a specific local repository directory. If not specified the local repository path configured in the
* Maven settings will be used.
*
- * @parameter expression="${localRepositoryPath}"
* @since 2.2
*/
+ @Parameter( property = "localRepositoryPath" )
private File localRepositoryPath;
/**
* The component used to validate the user-supplied artifact coordinates.
- *
- * @component
*/
+ @Component
private ModelValidator modelValidator;
/**
Modified: maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java?rev=1355014&r1=1355013&r2=1355014&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java Thu Jun 28 13:51:23 2012
@@ -23,6 +23,9 @@ import org.apache.maven.artifact.Artifac
import org.apache.maven.artifact.installer.ArtifactInstallationException;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
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.project.artifact.ProjectArtifactMetadata;
import java.io.File;
@@ -36,39 +39,29 @@ import java.util.List;
*
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
- * @goal install
- * @phase install
- * @threadSafe
*/
+@Mojo( name = "install", defaultPhase = LifecyclePhase.INSTALL, threadSafe = true )
public class InstallMojo
extends AbstractInstallMojo
{
/**
- * @parameter default-value="${project.packaging}"
- * @required
- * @readonly
*/
+ @Parameter( defaultValue = "${project.packaging}", required = true, readonly = true )
protected String packaging;
/**
- * @parameter default-value="${project.file}"
- * @required
- * @readonly
*/
+ @Parameter( defaultValue = "${project.file}", required = true, readonly = true )
private File pomFile;
/**
- * @parameter default-value="${project.artifact}"
- * @required
- * @readonly
*/
+ @Parameter( defaultValue = "${project.artifact}", required = true, readonly = true )
private Artifact artifact;
/**
- * @parameter default-value="${project.attachedArtifacts}
- * @required
- * @readonly
*/
+ @Parameter( defaultValue = "${project.attachedArtifacts}", required = true, readonly = true )
private List attachedArtifacts;
public void execute()