You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2008/02/01 23:23:19 UTC

svn commit: r617677 - in /maven/plugins/trunk/maven-war-plugin: ./ src/it/MWAR-96/ src/it/MWAR-96/src/ src/it/MWAR-96/src/main/ src/it/MWAR-96/src/main/webapp/ src/it/MWAR-96/src/main/webapp/WEB-INF/ src/main/java/org/apache/maven/plugin/war/ src/main/...

Author: olamy
Date: Fri Feb  1 14:23:09 2008
New Revision: 617677

URL: http://svn.apache.org/viewvc?rev=617677&view=rev
Log:
[MWAR-96] WebResource not filtered with system properties.
Now the plugin use the component maven-filtering


Added:
    maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/
    maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/pom.xml   (with props)
    maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/
    maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/
    maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/
    maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/WEB-INF/
    maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/WEB-INF/web.xml   (with props)
    maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/index.jsp   (with props)
    maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/verify.bsh   (with props)
Removed:
    maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/CompositeMap.java
    maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/ReflectionProperties.java
Modified:
    maven/plugins/trunk/maven-war-plugin/pom.xml
    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/packaging/AbstractWarPackagingTask.java
    maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java
    maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/AbstractWarMojoTest.java

Modified: maven/plugins/trunk/maven-war-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/pom.xml?rev=617677&r1=617676&r2=617677&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-war-plugin/pom.xml Fri Feb  1 14:23:09 2008
@@ -70,6 +70,11 @@
       <version>1.2.2</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-filtering</artifactId>
+      <version>1.0-alpha-1-SNAPSHOT</version>    
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>3.8.1</version>

Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/pom.xml?rev=617677&view=auto
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/pom.xml (added)
+++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/pom.xml Fri Feb  1 14:23:09 2008
@@ -0,0 +1,48 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd' xmlns='http://maven.apache.org/POM/4.0.0'>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>testwar</groupId>
+  <artifactId>MWAR-96</artifactId>
+  <packaging>war</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>MWAR-96 Maven Webapp</name>
+  <url>http://maven.apache.org</url>
+ <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <warSourceDirectory>src/main/webapp</warSourceDirectory>
+          <webResources>
+            <resource>
+              <filtering>true</filtering>
+              <directory>src/main/webapp</directory>
+              <includes>
+                <include>index.jsp</include>
+              </includes>
+            </resource>
+          </webResources>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/WEB-INF/web.xml?rev=617677&view=auto
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/WEB-INF/web.xml (added)
+++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/WEB-INF/web.xml Fri Feb  1 14:23:09 2008
@@ -0,0 +1,24 @@
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<web-app>
+  <display-name>Archetype Created Web Application</display-name>
+</web-app>

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/index.jsp?rev=617677&view=auto
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/index.jsp (added)
+++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/index.jsp Fri Feb  1 14:23:09 2008
@@ -0,0 +1,21 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<tr><td>java version</td><td>java version : ${java.version}</td></tr>
+<tr><td>Project</td><td>${pom.name}</td></tr>
+<tr><td>Version</td><td>${pom.version}</td></tr>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/index.jsp
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/src/main/webapp/index.jsp
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/verify.bsh?rev=617677&view=auto
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/verify.bsh (added)
+++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/verify.bsh Fri Feb  1 14:23:09 2008
@@ -0,0 +1,66 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target file is missing or not a directory." );
+        return false;
+    }
+  
+    File webappDirectory = new File( target, "MWAR-96-1.0-SNAPSHOT" );
+    if ( !webappDirectory.exists() || !webappDirectory.isDirectory() )
+    {
+        System.err.println( "webappDirectory is missing or not a directory." );
+        return false;
+    }   
+    
+    File param = new File ( webappDirectory, "index.jsp" );
+    if ( !param.exists() || param.isDirectory() )
+    {
+        System.err.println( "index.jsp file is missing or a directory." );
+        return false;
+    }    
+    FileInputStream fis = new FileInputStream ( param );
+    String paramContent = IOUtil.toString ( fis );
+    
+    
+    int indexOf = paramContent.indexOf( "<td>java version : 1.0-SNAPSHOT</td>" );
+    if ( indexOf >= 0)
+    {
+    	System.err.println( "index.jsp contains <td>java version : 1.0-SNAPSHOT</td>" );
+    	return false;
+    }
+    
+}
+catch( Throwable e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;

Propchange: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-96/verify.bsh
------------------------------------------------------------------------------
    svn:executable = *

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=617677&r1=617676&r2=617677&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 Fri Feb  1 14:23:09 2008
@@ -19,6 +19,13 @@
  * under the License.
  */
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.maven.archiver.MavenArchiveConfiguration;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
@@ -33,25 +40,14 @@
 import org.apache.maven.plugin.war.packaging.WarPackagingTask;
 import org.apache.maven.plugin.war.packaging.WarPostPackagingTask;
 import org.apache.maven.plugin.war.packaging.WarProjectPackagingTask;
-import org.apache.maven.plugin.war.util.CompositeMap;
-import org.apache.maven.plugin.war.util.PropertyUtils;
-import org.apache.maven.plugin.war.util.ReflectionProperties;
 import org.apache.maven.plugin.war.util.WebappStructure;
 import org.apache.maven.plugin.war.util.WebappStructureSerializer;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.filtering.MavenFileFilter;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
 /**
  * Contains commons jobs for war mojos
  * @version $Id$
@@ -180,6 +176,14 @@
      * @required
      */
     private ArchiverManager archiverManager;
+    
+    /**
+     * The Jar archiver needed for archiving classes directory into jar file under WEB-INF/lib.
+     *
+     * @parameter expression="${component.org.apache.maven.shared.filtering.MavenFileFilter}"
+     * @required
+     */
+    private MavenFileFilter mavenFileFilter;    
 
     private static final String WEB_INF = "WEB-INF";
 
@@ -540,36 +544,6 @@
             return filters;
         }
 
-        public Map getFilterProperties()
-            throws MojoExecutionException
-        {
-            Map filterProperties = new Properties();
-
-            // Project properties
-            filterProperties.putAll( project.getProperties() );
-
-            for ( Iterator i = filters.iterator(); i.hasNext(); )
-            {
-                String filtersfile = (String) i.next();
-
-                try
-                {
-                    Properties properties = PropertyUtils.loadPropertyFile( new File( filtersfile ), true, true );
-
-                    filterProperties.putAll( properties );
-                }
-                catch ( IOException e )
-                {
-                    throw new MojoExecutionException( "Error loading property file '" + filtersfile + "'", e );
-                }
-            }
-
-            // can't putAll, as ReflectionProperties doesn't enumerate - 
-            // so we make a composite map with the project variables as dominant
-            return new CompositeMap(
-                new Map[]{filterProperties, new ReflectionProperties( project ), System.getProperties()} );
-        }
-
         public WebappStructure getWebappStructure()
         {
             return webappStructure;
@@ -579,6 +553,13 @@
         {
             return overlayManager.getOverlayIds();
         }
+
+        public MavenFileFilter getMavenFileFilter()
+        {
+            return mavenFileFilter;
+        }
+        
+        
     }
 
     public MavenProject getProject()

Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java?rev=617677&r1=617676&r2=617677&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java Fri Feb  1 14:23:09 2008
@@ -19,30 +19,31 @@
  * under the License.
  */
 
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.war.AbstractWarMojo;
 import org.apache.maven.plugin.war.util.MappingUtils;
 import org.apache.maven.plugin.war.util.PathSet;
 import org.apache.maven.plugin.war.util.WebappStructure;
+import org.apache.maven.shared.filtering.MavenFilteringException;
+import org.apache.maven.shared.filtering.ReflectionProperties;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.UnArchiver;
 import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
 import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.InterpolationFilterReader;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.Map;
-
 /**
  * @author Stephane Nicoll
  */
@@ -193,37 +194,42 @@
      * @throws IOException            if an error occured while copying
      * @throws MojoExecutionException if an error occured while retrieving the filter properties
      */
-    protected boolean copyFilteredFile( String sourceId, WarPackagingContext context, File file, String targetFilename )
+    protected boolean copyFilteredFile( String sourceId, final WarPackagingContext context, File file, String targetFilename )
         throws IOException, MojoExecutionException
     {
 
         if ( context.getWebappStructure().registerFile( sourceId, targetFilename ) )
         {
             final File targetFile = new File( context.getWebappDirectory(), targetFilename );
-            // buffer so it isn't reading a byte at a time!
-            Reader fileReader = null;
-            Writer fileWriter = null;
             try
             {
                 // fix for MWAR-36, ensures that the parent dir are created first
                 targetFile.getParentFile().mkdirs();
 
-                fileReader = new BufferedReader( new FileReader( file ) );
-                fileWriter = new FileWriter( targetFile );
+                List defaultFilterWrappers = context.getMavenFileFilter().getDefaultFilterWrappers(
+                                                                                                    context
+                                                                                                        .getProject(),
+                                                                                                    context
+                                                                                                        .getFilters(),
+                                                                                                    true );
 
-                Reader reader = fileReader;
-                for ( int i = 0; i < getFilterWrappers().length; i++ )
+                List filterWrappers = new ArrayList( defaultFilterWrappers );
+                FileUtils.FilterWrapper filterWrapper = new FileUtils.FilterWrapper()
                 {
-                    FilterWrapper wrapper = getFilterWrappers()[i];
-                    reader = wrapper.getReader( reader, context.getFilterProperties() );
-                }
+                    public Reader getReader( Reader reader )
+                    {
+                        ReflectionProperties reflectionProperties = new ReflectionProperties( context.getProject(),
+                                                                                              true );
+                        return new InterpolationFilterReader( reader, reflectionProperties, "@", "@" );
+                    }
+                };
+                filterWrappers.add( filterWrapper );
 
-                IOUtil.copy( reader, fileWriter );
+                context.getMavenFileFilter().copyFile( file, targetFile, true, filterWrappers, null );
             }
-            finally
+            catch ( MavenFilteringException e )
             {
-                IOUtil.close( fileReader );
-                IOUtil.close( fileWriter );
+                throw new MojoExecutionException( e.getMessage(), e );
             }
             // Add the file to the protected list
             context.getLog().debug( " + " + targetFilename + " has been copied (filtered)." );
@@ -374,30 +380,6 @@
             return MappingUtils.evaluateFileNameMapping( AbstractWarMojo.DEFAULT_FILE_NAME_MAPPING, artifact );
         }
 
-    }
-
-    /**
-     * @return {@link FilterWrapper[]} which support ${} and @@ interpolation
-     */
-    private FilterWrapper[] getFilterWrappers()
-    {
-        return new FilterWrapper[]{
-            // support ${token}
-            new FilterWrapper()
-            {
-                public Reader getReader( Reader fileReader, Map filterProperties )
-                {
-                    return new InterpolationFilterReader( fileReader, filterProperties, "${", "}" );
-                }
-            },
-            // support @token@
-            new FilterWrapper()
-            {
-                public Reader getReader( Reader fileReader, Map filterProperties )
-                {
-                    return new InterpolationFilterReader( fileReader, filterProperties, "@", "@" );
-                }
-            }};
     }
 
     /**

Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java?rev=617677&r1=617676&r2=617677&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java Fri Feb  1 14:23:09 2008
@@ -19,18 +19,17 @@
  * under the License.
  */
 
+import java.io.File;
+import java.util.List;
+
 import org.apache.maven.archiver.MavenArchiveConfiguration;
-import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugin.war.util.WebappStructure;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.filtering.MavenFileFilter;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-
 /**
  * The packaging context.
  *
@@ -141,17 +140,6 @@
     List getFilters();
 
     /**
-     * Returns the filter properties to use to filter resources.
-     * <p/>
-     * TODO: this needs to be refactored to use the resource plugin somehow.
-     *
-     * @return a map of filter properties
-     * @throws MojoExecutionException if an error occured while reading a filter file
-     */
-    Map getFilterProperties()
-        throws MojoExecutionException;
-
-    /**
      * Returns the {@link WebappStructure}.
      *
      * @return the webapp structure
@@ -167,5 +155,11 @@
      * @return the list of registered overlays, including the current project
      */
     List getOwnerIds();
+    
+    /**
+     * @return {@link MavenFileFilter}
+     * @since 2.1-alpha-2
+     */
+    MavenFileFilter getMavenFileFilter();
 
 }

Modified: maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/AbstractWarMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/AbstractWarMojoTest.java?rev=617677&r1=617676&r2=617677&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/AbstractWarMojoTest.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/AbstractWarMojoTest.java Fri Feb  1 14:23:09 2008
@@ -23,6 +23,7 @@
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
 import org.apache.maven.plugin.war.stub.MavenProjectBasicStub;
 import org.apache.maven.plugin.war.stub.WarOverlayStub;
+import org.apache.maven.shared.filtering.MavenFileFilter;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
@@ -64,6 +65,7 @@
     {
         setVariableValueToObject( mojo, "filters", filters );
         setVariableValueToObject( mojo, "useCache", Boolean.FALSE );
+        setVariableValueToObject( mojo, "mavenFileFilter", lookup( MavenFileFilter.class.getName() ) );
         mojo.setClassesDirectory( classesDir );
         mojo.setWarSourceDirectory( webAppSource );
         mojo.setWebappDirectory( webAppDir );