You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2007/10/27 22:19:10 UTC
svn commit: r589208 -
/maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/AbstractSourceJarMojo.java
Author: dennisl
Date: Sat Oct 27 13:19:10 2007
New Revision: 589208
URL: http://svn.apache.org/viewvc?rev=589208&view=rev
Log:
[MSOURCE-18] Honour targetPath
Submitted by: Tim Pizey
Reviewed by: Dennis Lundberg
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=589208&r1=589207&r2=589208&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 Sat Oct 27 13:19:10 2007
@@ -212,8 +212,19 @@
{
excludes = (String[]) resourceExcludes.toArray( new String[resourceExcludes.size()] );
}
-
- addDirectory( archiver, sourceDirectory, includes, excludes );
+ String targetPath = resource.getTargetPath();
+ if ( targetPath != null )
+ {
+ if ( !targetPath.trim().endsWith( "/" ) )
+ {
+ targetPath += "/";
+ }
+ addDirectory( archiver, sourceDirectory, targetPath, includes, excludes );
+ }
+ else
+ {
+ addDirectory( archiver, sourceDirectory, includes, excludes );
+ }
}
}
}
@@ -257,6 +268,20 @@
try
{
archiver.addDirectory( sourceDirectory, includes, excludes );
+ }
+ catch ( ArchiverException e )
+ {
+ throw new MojoExecutionException( "Error adding directory to source archive.", e );
+ }
+ }
+
+ protected void addDirectory( Archiver archiver, File sourceDirectory, String prefix, String[] includes,
+ String[] excludes )
+ throws MojoExecutionException
+ {
+ try
+ {
+ archiver.addDirectory( sourceDirectory, prefix, includes, excludes );
}
catch ( ArchiverException e )
{