deprecate warName in favour of finalName, and add default excludes

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163985 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-20 16:52:03 +00:00
parent a40f1eff93
commit efebad61dc
1 changed files with 43 additions and 5 deletions

View File

@ -29,7 +29,9 @@ import org.codehaus.plexus.util.FileUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
@ -44,6 +46,7 @@ import java.util.Set;
* validator="" * validator=""
* expression="#project.build.finalName" * expression="#project.build.finalName"
* description="" * description=""
* deprecated="Please use the finalName element of build instead"
* @parameter name="archive" * @parameter name="archive"
* type="" * type=""
* required="false" * required="false"
@ -110,10 +113,6 @@ import java.util.Set;
public class WarMojo public class WarMojo
extends AbstractPlugin extends AbstractPlugin
{ {
private static final String[] DEFAULT_INCLUDES = new String[]{"**/**"};
private static final String[] DEFAULT_EXCLUDES = new String[]{"**/WEB-INF/web.xml"};
public static final String WEB_INF = "WEB-INF"; public static final String WEB_INF = "WEB-INF";
private String mode; private String mode;
@ -147,6 +146,8 @@ public class WarMojo
private MavenArchiveConfiguration archive = new MavenArchiveConfiguration(); private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
private static final String[] EMPTY_STRING_ARRAY = {};
public void copyResources( File sourceDirectory, File webappDirectory, String includes, String excludes, public void copyResources( File sourceDirectory, File webappDirectory, String includes, String excludes,
String webXml ) String webXml )
throws IOException throws IOException
@ -270,7 +271,8 @@ public class WarMojo
archiver.setOutputFile( warFile ); archiver.setOutputFile( warFile );
warArchiver.addDirectory( new File( webappDirectory ), DEFAULT_INCLUDES, DEFAULT_EXCLUDES ); String[] excludes = (String[]) getDefaultExcludes().toArray( EMPTY_STRING_ARRAY );
warArchiver.addDirectory( new File( webappDirectory ), null, excludes );
warArchiver.setWebxml( new File( webappDirectory, "WEB-INF/web.xml" ) ); warArchiver.setWebxml( new File( webappDirectory, "WEB-INF/web.xml" ) );
@ -280,4 +282,40 @@ public class WarMojo
} }
} }
/**
* @todo copied again. Next person to touch it puts it in the right place! :)
*/
public List getDefaultExcludes()
{
List defaultExcludes = new ArrayList();
defaultExcludes.add( "**/*~" );
defaultExcludes.add( "**/#*#" );
defaultExcludes.add( "**/.#*" );
defaultExcludes.add( "**/%*%" );
defaultExcludes.add( "**/._*" );
// CVS
defaultExcludes.add( "**/CVS" );
defaultExcludes.add( "**/CVS/**" );
defaultExcludes.add( "**/.cvsignore" );
// SCCS
defaultExcludes.add( "**/SCCS" );
defaultExcludes.add( "**/SCCS/**" );
// Visual SourceSafe
defaultExcludes.add( "**/vssver.scc" );
// Subversion
defaultExcludes.add( "**/.svn" );
defaultExcludes.add( "**/.svn/**" );
// Mac
defaultExcludes.add( "**/.DS_Store" );
// Special one for WARs
defaultExcludes.add( "**/" + WEB_INF + "/web.xml" );
return defaultExcludes;
}
} }