You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sn...@apache.org on 2008/01/13 14:18:37 UTC
svn commit: r611571 - in
/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war:
AbstractWarMojo.java WarMojo.java
Author: snicoll
Date: Sun Jan 13 05:18:36 2008
New Revision: 611571
URL: http://svn.apache.org/viewvc?rev=611571&view=rev
Log:
MWAR-135: Add an option to exclude content from the generated archive to implement the skinny war process (packagingExcludes)
Modified:
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java?rev=611571&r1=611570&r2=611571&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java Sun Jan 13 05:18:36 2008
@@ -191,15 +191,16 @@
public static final String DEFAULT_FILE_NAME_MAPPING = "${artifactId}-${version}.${extension}";
/**
- * The comma separated list of tokens to include in the WAR.
- * Default is '**'.
+ * The comma separated list of tokens to include when copying content
+ * of the warSourceDirectory. Default is '**'.
*
* @parameter alias="includes"
*/
private String warSourceIncludes = "**";
/**
- * The comma separated list of tokens to exclude from the WAR.
+ * The comma separated list of tokens to exclude when copying content
+ * of the warSourceDirectory.
*
* @parameter alias="excludes"
*/
@@ -247,7 +248,7 @@
/**
* Returns a string array of the excludes to be used
- * when assembling/copying the war.
+ * when copying the content of the war source directory.
*
* @return an array of tokens to exclude
*/
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java?rev=611571&r1=611570&r2=611571&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java Sun Jan 13 05:18:36 2008
@@ -29,9 +29,11 @@
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.jar.ManifestException;
import org.codehaus.plexus.archiver.war.WarArchiver;
+import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.io.IOException;
+import java.util.Arrays;
/**
* Build a war/webapp.
@@ -69,6 +71,15 @@
private String classifier;
/**
+ * The comma separated list of tokens to exclude from the WAR before
+ * packaging. This option may be used to implement the skinny war use
+ * case.
+ *
+ * @parameter alias="packagingExcludes"
+ */
+ private String packagingExcludes;
+
+ /**
* The Jar archiver.
*
* @parameter expression="${component.org.codehaus.plexus.archiver.Archiver#war}"
@@ -175,7 +186,9 @@
archiver.setOutputFile( warFile );
- warArchiver.addDirectory( getWebappDirectory() );
+ getLog().debug(
+ "Excluding " + Arrays.toString( getPackagingExcludes() ) + " for the generated webapp archive." );
+ warArchiver.addDirectory( getWebappDirectory(), new String[]{"**"}, getPackagingExcludes() );
final File webXmlFile = new File( getWebappDirectory(), "WEB-INF/web.xml" );
if ( webXmlFile.exists() )
@@ -262,6 +275,24 @@
public void setClassifier( String classifier )
{
this.classifier = classifier;
+ }
+
+ public String[] getPackagingExcludes()
+ {
+ if ( StringUtils.isEmpty( packagingExcludes ) )
+ {
+ return new String[0];
+ }
+ else
+ {
+ return StringUtils.split( packagingExcludes, "," );
+ }
+
+ }
+
+ public void setPackagingExcludes( String packagingExcludes )
+ {
+ this.packagingExcludes = packagingExcludes;
}
public String getOutputDirectory()