maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war WarMojo.java
Date Wed, 20 Apr 2005 16:52:03 GMT
brett       2005/04/20 09:52:03

  Modified:    maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war
                        WarMojo.java
  Log:
  deprecate warName in favour of finalName, and add default excludes
  
  Revision  Changes    Path
  1.15      +44 -6     maven-components/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
  
  Index: WarMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- WarMojo.java	15 Apr 2005 04:52:30 -0000	1.14
  +++ WarMojo.java	20 Apr 2005 16:52:03 -0000	1.15
  @@ -29,7 +29,9 @@
   
   import java.io.File;
   import java.io.IOException;
  +import java.util.ArrayList;
   import java.util.Iterator;
  +import java.util.List;
   import java.util.Set;
   
   /**
  @@ -44,6 +46,7 @@
    * validator=""
    * expression="#project.build.finalName"
    * description=""
  + * deprecated="Please use the finalName element of build instead"
    * @parameter name="archive"
    * type=""
    * required="false"
  @@ -110,10 +113,6 @@
   public class WarMojo
       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";
   
       private String mode;
  @@ -147,6 +146,8 @@
   
       private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
   
  +    private static final String[] EMPTY_STRING_ARRAY = {};
  +
       public void copyResources( File sourceDirectory, File webappDirectory, String includes,
String excludes,
                                  String webXml )
           throws IOException
  @@ -270,7 +271,8 @@
   
                   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" ) );
   
  @@ -280,4 +282,40 @@
           }
       }
   
  +    /**
  +     * @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;
  +    }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message