You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2012/08/26 23:41:59 UTC

svn commit: r1377525 - in /maven/sandbox/trunk/plugins/maven-scm-publish-plugin: ./ src/main/java/org/apache/maven/plugins/scmpublish/

Author: hboutemy
Date: Sun Aug 26 21:41:58 2012
New Revision: 1377525

URL: http://svn.apache.org/viewvc?rev=1377525&view=rev
Log:
use plugin-tools java 5 annotations

Modified:
    maven/sandbox/trunk/plugins/maven-scm-publish-plugin/pom.xml
    maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
    maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java
    maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java
    maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java

Modified: maven/sandbox/trunk/plugins/maven-scm-publish-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-scm-publish-plugin/pom.xml?rev=1377525&r1=1377524&r2=1377525&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/maven-scm-publish-plugin/pom.xml (original)
+++ maven/sandbox/trunk/plugins/maven-scm-publish-plugin/pom.xml Sun Aug 26 21:41:58 2012
@@ -49,6 +49,7 @@ under the License.
   <properties>
     <scmVersion>1.7</scmVersion>
     <mavenVersion>2.2.1</mavenVersion>
+    <pluginTools>3.1</pluginTools>
   </properties>
 
   <dependencies>
@@ -78,6 +79,11 @@ under the License.
       <version>${mavenVersion}</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-annotations</artifactId>
+      <version>${pluginTools}</version>
+    </dependency>
+    <dependency>
       <groupId>org.apache.maven.scm</groupId>
       <artifactId>maven-scm-api</artifactId>
       <version>${scmVersion}</version>
@@ -123,11 +129,28 @@ under the License.
         <filtering>true</filtering>
       </resource>
     </resources>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-plugin-plugin</artifactId>
+          <version>${pluginTools}</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <plugins>
       <plugin>
         <artifactId>maven-plugin-plugin</artifactId>
+        <configuration>
+          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+        </configuration>
         <executions>
           <execution>
+            <id>mojo-descriptor</id>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+          <execution>
             <id>generated-helpmojo</id>
             <goals>
               <goal>helpmojo</goal>

Modified: maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java?rev=1377525&r1=1377524&r2=1377525&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java (original)
+++ maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/AbstractScmPublishMojo.java Sun Aug 26 21:41:58 2012
@@ -24,6 +24,8 @@ import org.apache.maven.execution.MavenS
 import org.apache.maven.plugin.AbstractMojo;
 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.Parameter;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmResult;
@@ -49,131 +51,107 @@ public abstract class AbstractScmPublish
 
     /**
      * Location of the inventory file.
-     *
-     * @parameter expression="${scmpublish.inventoryFile}"
-     * default-value="${project.build.directory}/scmpublish-inventory.js"
      */
+    @Parameter( property = "scmpublish.inventoryFile", defaultValue="${project.build.directory}/scmpublish-inventory.js" )
     protected File inventoryFile;
 
     /**
      * Location of the scm publication tree.
-     *
-     * @parameter expression="${scmpublish.pubScmUrl}" default-value="${project.distributionManagement.site.url}"
-     * @required
      */
+    @Parameter( property = "scmpublish.pubScmUrl", defaultValue = "${project.distributionManagement.site.url}", required = true )
     protected String pubScmUrl;
 
     /**
      * Location where the scm check-out is done.
-     *
-     * @parameter expression="${scmpublish.checkoutDirectory}"
-     * default-value="${project.build.directory}/scmpublish-checkout"
      */
+    @Parameter( property = "scmpublish.checkoutDirectory", defaultValue="${project.build.directory}/scmpublish-checkout" )
     protected File checkoutDirectory;
 
     /**
      * Patterns to exclude from the scm tree.
-     *
-     * @parameter
      */
+    @Parameter
     protected String excludes;
 
     /**
      * Patterns to include in the scm tree.
-     *
-     * @parameter
      */
+    @Parameter
     protected String includes;
 
     /**
      * List of SCM provider implementations.
-     *
-     * @parameter
      */
+    @Parameter
     private Map<String, String> providerImplementations;
 
     /**
      * The SCM manager.
-     *
-     * @component
      */
+    @Component
     private ScmManager scmManager;
 
     /**
      * Tool that gets a configured SCM repository from release configuration.
-     *
-     * @component
      */
+    @Component
     protected ScmRepositoryConfigurator scmRepositoryConfigurator;
 
     /**
      * The SCM username to use.
-     *
-     * @parameter expression="${username}"
      */
+    @Parameter( property = "username" )
     protected String username;
 
     /**
      * The SCM password to use.
-     *
-     * @parameter expression="${password}"
      */
+    @Parameter( property = "password" )
     protected String password;
 
     /**
-     * @parameter default-value="${settings}"
-     * @required
-     * @readonly
-     */
-    protected Settings settings;
-
-    /**
      * Use a local checkout instead of doing a checkout from the upstream repository. ATTENTION: This will only work
      * with distributed SCMs which support the file:// protocol TODO: we should think about having the defaults for the
      * various SCM providers provided via modello!
-     *
-     * @parameter expression="${localCheckout}" default-value="false"
-     * @since 2.0
      */
+    @Parameter( property = "localCheckout", defaultValue = "false" )
     protected boolean localCheckout;
 
     /**
-     * @parameter default-value="${basedir}"
-     * @required
-     * @readonly
-     */
-    protected File basedir;
-
-    /**
-     * @parameter default-value="${session}"
-     * @readonly
-     * @required
-     */
-    protected MavenSession session;
-
-    /**
      * The outputEncoding parameter of the site plugin. This plugin will corrupt your site
      * if this does not match the value used by the site plugin.
-     *
-     * @parameter expression="${outputEncoding}" default-value="${project.reporting.outputEncoding}"
      */
+    @Parameter( property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}" )
     protected String siteOutputEncoding;
 
     /**
      * if the checkout directory exists and this flag is activated the plugin will try an update rather
      * than delete then checkout
-     *
-     * @parameter expression="${scmpublish.tryUpdate}" default-value="false"
      */
+    @Parameter( property = "scmpublish.tryUpdate", defaultValue = "false" )
     protected boolean tryUpdate;
 
     /**
      * Do not delete files to the scm
-     *
-     * @parameter expression="${scmpublish.skipDeletedFiles}" default-value="false"
      */
+    @Parameter( property = "scmpublish.skipDeletedFiles", defaultValue = "false" )
     protected boolean skipDeletedFiles;
 
+    /**
+     */
+    @Parameter( defaultValue = "${basedir}", readonly = true )
+    protected File basedir;
+
+    /**
+     */
+    @Component
+    protected Settings settings;
+
+    /**
+     */
+    @Component
+    protected MavenSession session;
+
     protected ScmProvider scmProvider;
 
     protected ScmRepository scmRepository;

Modified: maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java?rev=1377525&r1=1377524&r2=1377525&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java (original)
+++ maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishInventoryMojo.java Sun Aug 26 21:41:58 2012
@@ -25,6 +25,8 @@ import java.util.List;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
 
 /**
  * Prepare a directory for version-managed site generation. This checks out the specified directory from the SCM,
@@ -42,12 +44,9 @@ import org.apache.maven.plugin.MojoFailu
  * 
  * TODO: we want
  * multiple includes/excludes, but the scm API doesn't go there.
- * 
- * @goal prepare
- * @phase pre-site
- * @aggregate
  * @deprecated superseded by publish-scm which does the same in on step only and has more features
  */
+@Mojo( name = "prepare", defaultPhase = LifecyclePhase.PRE_SITE, aggregator = true )
 public class ScmPublishInventoryMojo
     extends AbstractScmPublishMojo
 {

Modified: maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java?rev=1377525&r1=1377524&r2=1377525&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java (original)
+++ maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishMojo.java Sun Aug 26 21:41:58 2012
@@ -24,6 +24,9 @@ import org.apache.commons.io.FilenameUti
 import org.apache.commons.io.IOUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+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.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.command.add.AddScmResult;
@@ -49,34 +52,29 @@ import java.util.TreeSet;
 /**
  * Compare the list of files now on disk to the original inventory, then fire off scm adds and deletes as needed.
  *
- * @goal publish
- * @phase post-site
- * @aggregate
  * @deprecated superseded by publish-scm which does the same in on step only and has more features
  */
+@Mojo( name = "publish", defaultPhase = LifecyclePhase.POST_SITE, aggregator = true )
 public class ScmPublishPublishMojo
     extends AbstractScmPublishMojo
 {
 
     /**
      * Display list of added, deleted, and changed files, but do not do any actual SCM operations.
-     *
-     * @parameter expression="${scmpublish.dryRun}"
      */
+    @Parameter( property = "scmpublish.dryRun" )
     private boolean dryRun;
 
     /**
      * Run add and delete commands, but leave the actually checkin for the user to run manually.
-     *
-     * @parameter expression="${scmpublish.skipCheckin}"
      */
+    @Parameter( property = "scmpublish.skipCheckin" )
     private boolean skipCheckin;
 
     /**
      * SCM log/checkin comment for this publication.
-     *
-     * @parameter expression="${scmpublish.checkinComment}" default-value="Site checkin for project ${project.name}"
      */
+    @Parameter( property = "scmpublish.checkinComment", defaultValue="Site checkin for project ${project.name}" )
     private String checkinComment;
 
     /**
@@ -86,9 +84,8 @@ public class ScmPublishPublishMojo
 
     /**
      * extra file extensions to normalize line ending (will be added to list html,css,js)
-     *
-     * @parameter
      */
+    @Parameter
     protected String[] extraNormalizeExtensions;
 
     private File relativize( File base, File file )

Modified: maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java?rev=1377525&r1=1377524&r2=1377525&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java (original)
+++ maven/sandbox/trunk/plugins/maven-scm-publish-plugin/src/main/java/org/apache/maven/plugins/scmpublish/ScmPublishPublishScmMojo.java Sun Aug 26 21:41:58 2012
@@ -21,6 +21,9 @@ import org.apache.commons.io.filefilter.
 import org.apache.commons.io.filefilter.NotFileFilter;
 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.MavenProject;
 
 /*
@@ -46,25 +49,20 @@ import org.apache.maven.project.MavenPro
  * Publish a content to scm in one step. By default, content is taken from default site staging directory
  * <code>${project.build.directory}/staging</code>.
  * Can be used without project, so usable to update any SCM with any content.
- * 
- * @goal publish-scm
- * @aggregate
- * @requiresProject false
  */
+@Mojo( name = "publish-scm", aggregator = true, requiresProject = false )
 public class ScmPublishPublishScmMojo
     extends ScmPublishPublishMojo
 {
     /**
      * The content to be published.
-     * 
-     * @parameter expression="${scmpublish.content}" default-value="${project.build.directory}/staging"
      */
+    @Parameter( property = "scmpublish.content", defaultValue="${project.build.directory}/staging" )
     private File content;
 
     /**
-     * @parameter default-value="${project}"
-     * @readonly
      */
+    @Component
     protected MavenProject project;
 
     private List<File> deleted = new ArrayList<File>();