Author: dennisl
Date: Tue Feb 24 22:05:10 2009
New Revision: 747570

URL: http://svn.apache.org/viewvc?rev=747570&view=rev
Log:
[MSOURCES-34] Allow the artifact type to be changed
Submitted by: Marvin Froeder
Reviewed by: Dennis Lundberg

o The patch didn't apply anymore, but the changes were easy to make by hand

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=747570&r1=747569&r2=747570&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
 Tue Feb 24 22:05:10 2009
@@ -143,14 +143,14 @@
      * @return the compile or test sources
      */
     protected abstract List getSources( MavenProject p )
-               throws MojoExecutionException;
+        throws MojoExecutionException;
 
     /**
      * @param p not null
      * @return the compile or test resources
      */
     protected abstract List getResources( MavenProject p )
-               throws MojoExecutionException;
+        throws MojoExecutionException;
 
     protected void packageSources( MavenProject p )
         throws MojoExecutionException
@@ -187,7 +187,7 @@
             archiveProjectContent( subProject, archiver );
         }
 
-        File outputFile = new File( outputDirectory, finalName + "-" + 
getClassifier() + ".jar" );
+        File outputFile = new File( outputDirectory, finalName + "-" + 
getClassifier() + getExtension() );
         try
         {
             archiver.setDestFile( outputFile );
@@ -204,7 +204,7 @@
 
         if ( attach )
         {
-            projectHelper.attachArtifact( project, "java-source", 
getClassifier(), outputFile );
+            projectHelper.attachArtifact( project, getType(), getClassifier(), 
outputFile );
         }
         else
         {
@@ -343,6 +343,11 @@
         }
     }
 
+    protected String getExtension()
+    {
+        return ".jar";
+    }
+
     protected MavenProject getProject( MavenProject p )
     {
         if ( p.getExecutionProject() != null )
@@ -352,4 +357,9 @@
 
         return p;
     }
+
+    protected String getType()
+    {
+        return "java-source";
+    }
 }


Reply via email to