Author: pgier
Date: Wed Apr  8 21:59:54 2009
New Revision: 763422

URL: http://svn.apache.org/viewvc?rev=763422&view=rev
Log:
[MSOURCES-28] Add parameter to force jar creation or not based on when sources 
were last updated.

Modified:
    
maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.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=763422&r1=763421&r2=763422&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
 Wed Apr  8 21:59:54 2009
@@ -180,6 +180,16 @@
      */
     protected List reactorProjects;
 
+    /**
+     * Whether creating the archive should be forced.  If set to true, the jar 
will
+     * always be created.  If set to false, the jar will only be created when 
the
+     * sources are newer than the jar.
+     *
+     * @parameter expression="${source.forceCreation}" default-value="false"
+     * @since 2.1
+     */
+    private boolean forceCreation;
+
     // ----------------------------------------------------------------------
     // Public methods
     // ----------------------------------------------------------------------
@@ -256,10 +266,14 @@
         }
 
         File outputFile = new File( outputDirectory, finalName + "-" + 
getClassifier() + getExtension() );
+        
         try
         {
             archiver.setOutputFile( outputFile );
+
             archive.setAddMavenDescriptor( false );
+            archive.setForced( forceCreation );
+
             archiver.createArchive( project, archive );
         }
         catch ( IOException e )


Reply via email to