maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r659254 - in /maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source: AbstractSourceJarMojo.java AggregatorSourceJarMojo.java SourceJarMojo.java TestSourceJarMojo.java
Date Thu, 22 May 2008 20:55:58 GMT
Author: vsiveton
Date: Thu May 22 13:55:57 2008
New Revision: 659254

URL: http://svn.apache.org/viewvc?rev=659254&view=rev
Log:
o updated javadoc
o improved code readingness

Modified:
    maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.java
    maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AggregatorSourceJarMojo.java
    maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/SourceJarMojo.java
    maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceJarMojo.java

Modified: maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.java?rev=659254&r1=659253&r2=659254&view=diff
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.java
(original)
+++ maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.java
Thu May 22 13:55:57 2008
@@ -40,6 +40,7 @@
  * Base class for bundling sources into a jar archive.
  *
  * @version $Id$
+ * @since 2.0.3
  */
 public abstract class AbstractSourceJarMojo
     extends AbstractMojo
@@ -47,6 +48,8 @@
     private static final String[] DEFAULT_INCLUDES = new String[]{"**/*"};
 
     /**
+     * The Maven Project Object
+     *
      * @parameter expression="${project}"
      * @readonly
      * @required
@@ -106,27 +109,44 @@
      */
     protected List reactorProjects;
 
-    protected abstract String getClassifier();
-
-    protected abstract List getSources( MavenProject project );
+    // ----------------------------------------------------------------------
+    // Public methods
+    // ----------------------------------------------------------------------
 
-    protected abstract List getResources( MavenProject project );
-
-    /**
-     * @see org.apache.maven.plugin.AbstractMojo#execute()
-     */
+    /** {@inheritDoc} */
     public void execute()
         throws MojoExecutionException
     {
         packageSources( project );
     }
 
-    protected void packageSources( MavenProject project )
+    // ----------------------------------------------------------------------
+    // Protected methods
+    // ----------------------------------------------------------------------
+
+    /**
+     * @return the wanted classifier, ie <code>sources</code> or <code>test-sources</code>
+     */
+    protected abstract String getClassifier();
+
+    /**
+     * @param p not null
+     * @return the compile or test sources
+     */
+    protected abstract List getSources( MavenProject p );
+
+    /**
+     * @param p not null
+     * @return the compile or test resources
+     */
+    protected abstract List getResources( MavenProject p );
+
+    protected void packageSources( MavenProject p )
         throws MojoExecutionException
     {
-        if ( !"pom".equals( project.getPackaging() ) )
+        if ( !"pom".equals( p.getPackaging() ) )
         {
-            packageSources( Arrays.asList( new Object[]{project} ) );
+            packageSources( Arrays.asList( new Object[]{p} ) );
         }
     }
 
@@ -145,14 +165,14 @@
 
             for ( Iterator i = projects.iterator(); i.hasNext(); )
             {
-                MavenProject project = getProject( (MavenProject) i.next() );
+                MavenProject subProject = getProject( (MavenProject) i.next() );
 
-                if ( "pom".equals( project.getPackaging() ) )
+                if ( "pom".equals( subProject.getPackaging() ) )
                 {
                     continue;
                 }
 
-                archiveProjectContent( project, archiver );
+                archiveProjectContent( subProject, archiver );
             }
 
             File outputFile = new File( outputDirectory, finalName + "-" + getClassifier()
+ ".jar" );
@@ -183,10 +203,10 @@
         }
     }
 
-    protected void archiveProjectContent( MavenProject project, Archiver archiver )
+    protected void archiveProjectContent( MavenProject p, Archiver archiver )
         throws MojoExecutionException
     {
-        for ( Iterator i = getSources( project ).iterator(); i.hasNext(); )
+        for ( Iterator i = getSources( p ).iterator(); i.hasNext(); )
         {
             String s = (String) i.next();
 
@@ -199,7 +219,7 @@
         }
 
         //MAPI: this should be taken from the resources plugin
-        for ( Iterator i = getResources( project ).iterator(); i.hasNext(); )
+        for ( Iterator i = getResources( p ).iterator(); i.hasNext(); )
         {
             Resource resource = (Resource) i.next();
 
@@ -312,15 +332,13 @@
         }
     }
 
-    protected MavenProject getProject( MavenProject project )
+    protected MavenProject getProject( MavenProject p )
     {
-        if ( project.getExecutionProject() != null )
+        if ( p.getExecutionProject() != null )
         {
-            return project.getExecutionProject();
-        }
-        else
-        {
-            return project;
+            return p.getExecutionProject();
         }
+
+        return p;
     }
 }

Modified: maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AggregatorSourceJarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AggregatorSourceJarMojo.java?rev=659254&r1=659253&r2=659254&view=diff
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AggregatorSourceJarMojo.java
(original)
+++ maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AggregatorSourceJarMojo.java
Thu May 22 13:55:57 2008
@@ -22,8 +22,9 @@
 import org.apache.maven.plugin.MojoExecutionException;
 
 /**
- * Aggregrate sources for all modules in an aggregator project.
+ * Aggregate sources for all modules in an aggregator project.
  *
+ * @version $Id$
  * @goal aggregate
  * @phase package
  * @aggregator
@@ -33,9 +34,7 @@
 public class AggregatorSourceJarMojo
     extends SourceJarMojo
 {
-    /**
-     * @see org.apache.maven.plugin.AbstractMojo#execute()
-     */
+    /** {@inheritDoc} */
     public void execute()
         throws MojoExecutionException
     {

Modified: maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/SourceJarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/SourceJarMojo.java?rev=659254&r1=659253&r2=659254&view=diff
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/SourceJarMojo.java
(original)
+++ maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/SourceJarMojo.java
Thu May 22 13:55:57 2008
@@ -32,28 +32,29 @@
  * @goal jar
  * @phase package
  * @execute phase="generate-sources"
- * @since 2.0
+ * @since 2.0.3
  */
 public class SourceJarMojo
     extends AbstractSourceJarMojo
 {
-    protected List getSources( MavenProject project )
+    /** {@inheritDoc} */
+    protected List getSources( MavenProject p )
     {
-        return project.getCompileSourceRoots();
+        return p.getCompileSourceRoots();
     }
 
-    protected List getResources( MavenProject project )
+    /** {@inheritDoc} */
+    protected List getResources( MavenProject p )
     {
         if ( excludeResources )
         {
             return Collections.EMPTY_LIST;
         }
-        else
-        {
-            return project.getResources();
-        }
+
+        return p.getResources();
     }
 
+    /** {@inheritDoc} */
     protected String getClassifier()
     {
         return "sources";

Modified: maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceJarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceJarMojo.java?rev=659254&r1=659253&r2=659254&view=diff
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceJarMojo.java
(original)
+++ maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceJarMojo.java
Thu May 22 13:55:57 2008
@@ -30,28 +30,29 @@
  * @goal test-jar
  * @phase package
  * @execute phase="generate-sources"
- * @since 2.0.1
+ * @since 2.0.3
  */
 public class TestSourceJarMojo
     extends AbstractSourceJarMojo
 {
-    protected List getSources( MavenProject project )
+    /** {@inheritDoc} */
+    protected List getSources( MavenProject p )
     {
-        return project.getTestCompileSourceRoots();
+        return p.getTestCompileSourceRoots();
     }
 
-    protected List getResources( MavenProject project )
+    /** {@inheritDoc} */
+    protected List getResources( MavenProject p )
     {
         if ( excludeResources )
         {
             return Collections.EMPTY_LIST;
         }
-        else
-        {
-            return project.getTestResources();
-        }
+
+        return p.getTestResources();
     }
 
+    /** {@inheritDoc} */
     protected String getClassifier()
     {
         return "test-sources";



Mime
View raw message