You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2020/02/13 22:11:10 UTC

[maven-filtering] annotated tag maven-filtering-1.0-alpha-1 created (now a610e07)

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a change to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git.


      at a610e07  (tag)
 tagging 220573947fc7aae6efb2f1bbcdfece391e0d0233 (commit)
      by Oliver Lamy
      on Tue Jul 29 22:18:17 2008 +0000

- Log -----------------------------------------------------------------
maven-filtering-1.0-alpha-1
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new 3816102  [MNG-3374] Create a common component for files filtering start some jobs for this issue
     new cdb2715  remove eclipse files
     new eb5690f  ignore eclipse files
     new 790d3a2  add a plexus component which aplly filtering on List of org.apache.maven.model.Resource
     new 559b83b  add project filter files in the value interpolation Map add a hack for interpolation on file for windows
     new 73709fa  remove a printStackTrace
     new ab64b03  add unit on PropertyUtils
     new 8e289c9  remove french character
     new 76bc417  if the resource contains empty expressions (${} or @@) the component filtered with a complex object toString or could failed to getSystemProperty
     new d01b93a  fix some checkstyle errors
     new b711d73  fix license header add junit
     new 1607cfb  fix javadoc
     new 0ff416e  add a method which allow users to have their own list of FilterWrappers
     new 4d2cb14  start a simple documentation
     new 358ec19  add a parameter to pass a list of file extensions to not filtering
     new 93a7ba9  add a predefined list (jpg,jpeg,gif,bmp,png) of known extensions which doesn't support filtering force the extension in lowerCase when testing if the file need filtering
     new b1eca6c  move a method from private to public
     new 9447d00  update documentation merge duplicate code
     new 06f6dc1  add : - unit with adding token - test escaping windows path - usage page with code samples
     new 09751f3  fix documentation
     new 6d9b56e  change the Properties loading order now System Properties wins
     new 60725be  replace using System.getProperties() with mavenSession.getExecutionProperties()
     new 7f8192a  update documentation add missing file
     new c283383  fix documentation
     new 0e49f4c  fix documentation add mavenSession parameter
     new 983c911  fix documentation add missing mavenSession parameter
     new 9371ad3  add a bean to configure a filtering execution request this will prevent having methods with dozens of parameters
     new 6b38f46  add some logging and a null check
     new 7465c47  add filterWrappers coming from the execution configuration bean update documentation
     new 0758f94  add units on exclude/include
     new 313cde1  fix scm info
     new 98f60d8  skip empty file name
     new a18a589  [MRESOURCES-62] changed message from "default encoding" to "platform encoding (xxx actually)" to be more explicit
     new 835f17d  o archiva and continuum are now TLP
     new 2a0196d  use last parent
     new acaf645  remove unused imports and checkstyle error
     new 47ed5a1  use plexus-interpolation in the maven-filtering component
     new e0ed77d  use last plexus-utils version
     new 4c8b07c  use released version
     new a8cec41  fix checstyle errors
     new 9bd05a3  add link in the documentation
     new dba4186  remove unused repository
     new 0de28ba  remove inherited links lock site plugin version
     new 2205739  [maven-release-plugin]  copy for tag maven-filtering-1.0-alpha-1

The 44 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-filtering] 21/44: change the Properties loading order now System Properties wins

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 6d9b56ec1ea12201c9e2053e073f0410b14e57eb
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sun Feb 24 09:06:43 2008 +0000

    change the Properties loading order now System Properties wins
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@630604 13f79535-47bb-0310-9956-ffa450edef68
---
 .../shared/filtering/DefaultMavenFileFilter.java   | 31 +++++++++++++++-------
 src/site/apt/index.apt                             | 22 ++++++++-------
 .../DefaultMavenResourcesFilteringTest.java        |  3 +--
 3 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index a089ab9..848a257 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -80,27 +80,38 @@ public class DefaultMavenFileFilter
                                           final boolean escapedBackslashesInFilePath )
         throws MavenFilteringException
     {
-
-        final Properties filterProperties = new Properties();
-
-        // System properties
-        filterProperties.putAll( System.getProperties() );
-
-        // Project properties
-        filterProperties.putAll( mavenProject.getProperties() == null ? Collections.EMPTY_MAP : mavenProject
-            .getProperties() );
+        
+        // here we build some properties which will be used to read some properties files
+        // to interpolate the expression ${ }  in this properties file
 
         // Take a copy of filterProperties to ensure that evaluated filterTokens are not propagated
         // to subsequent filter files. NB this replicates current behaviour and seems to make sense.
+        
         final Properties baseProps = new Properties();
-        baseProps.putAll( filterProperties );
 
+        // Project properties
+        baseProps.putAll( mavenProject.getProperties() == null ? Collections.EMPTY_MAP : mavenProject
+            .getProperties() );        
+        // System properties wins
+        baseProps.putAll( System.getProperties() );         
+        
+        // now we build properties to use for resources interpolation
+        
+        final Properties filterProperties = new Properties();
+        
         loadProperties( filterProperties, filters, baseProps );
 
         loadProperties( filterProperties, mavenProject.getFilters(), baseProps );
 
         loadProperties( filterProperties, mavenProject.getBuild().getFilters(), baseProps );
 
+        // Project properties
+        filterProperties.putAll( mavenProject.getProperties() == null ? Collections.EMPTY_MAP : mavenProject
+            .getProperties() );        
+        // System properties wins
+        filterProperties.putAll( System.getProperties() );        
+        
+        
         List defaultFilterWrappers = new ArrayList( 3 );
 
         // support ${token}
diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
index 6d79423..cf8e617 100755
--- a/src/site/apt/index.apt
+++ b/src/site/apt/index.apt
@@ -42,27 +42,29 @@ Maven Filtering Component
   This component has a method which returns the default FileUtils.FilterWrapper.
   This are :
   
-    * interpolation with token ${ } and values from SystemProps, project.properties, filters, project.filters and project.build.filters
+    * interpolation with token $\{ \} and values from filters, project.filters, project.build.filters, pom.properties and SystemProps
     
-    * interpolation with token @ @ and values from SystemProps, project.properties, filters, project.filters and project.build.filters
+    * interpolation with token @ @ and values from filters, project.filters, project.build.filters, pom.properties and SystemProps
     
-    * interpolation with token ${ } and values from mavenProject interpolation
+    * interpolation with token $\{ \} and values from mavenProject interpolation
     
     []
     
     The values (Properties object) used for interpolation are loaded with the following order :
+   
+    * List of properties file ( the method has a parameter which accept a List of String -> path properties files )
+   
+    * pom.filters
     
-    * System Properties
+    * pom.build.filters
     
     * pom.properties
     
-    * List of properties ( the method has a parameter which accept a List of String -> path properties files )
-    
-    * pom.filters
-    
-    * pom.build.filters
+    * System Properties
     
     []
     
     <<NOTE>> : As it's a Properties object, last defined key/value pair wins . 
-    The value for key java.version can be overriding with a property in the maven project (yes crazy but possible).
+    
+    <<NOTE>> : When building the global Properties object and reading the properties files defined the different filters, 
+    interpolation with the token $\{ \} is supported for this filters with a limited properties values coming from pom.properties and System Properties (last wins too)
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index 8668ee6..059eff8 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -29,7 +29,6 @@ import java.util.List;
 import java.util.Properties;
 
 import org.apache.maven.model.Resource;
-import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
@@ -106,7 +105,7 @@ public class DefaultMavenResourcesFilteringTest
         
         assertEquals( "@@", result.getProperty( "emptyexpression" ) );
         assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
-        assertEquals( "zloug", result.getProperty( "javaVersion" ) );
+        assertEquals( System.getProperty( "java.version" ), result.getProperty( "javaVersion" ) );
         
         assertEquals( baseDir.toString(), result.get( "base" ) );
         


[maven-filtering] 01/44: [MNG-3374] Create a common component for files filtering start some jobs for this issue

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 38161027604e0f886cb273e210424c2b2990122f
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Thu Jan 24 00:28:33 2008 +0000

    [MNG-3374] Create a common component for files filtering
    start some jobs for this issue
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@614750 13f79535-47bb-0310-9956-ffa450edef68
---
 .classpath                                         |  21 +++
 .project                                           |  13 ++
 .settings/org.eclipse.jdt.core.prefs               |   5 +
 pom.xml                                            |  76 ++++++++
 .../maven/shared/filtering/CompositeMap.java       | 140 +++++++++++++++
 .../shared/filtering/DefaultMavenFileFilter.java   | 153 ++++++++++++++++
 .../maven/shared/filtering/MavenFileFilter.java    |  79 ++++++++
 .../shared/filtering/MavenFilteringException.java  |  63 +++++++
 .../maven/shared/filtering/PropertyUtils.java      | 199 +++++++++++++++++++++
 .../shared/filtering/ReflectionProperties.java     |  87 +++++++++
 .../shared/filtering/TestReflectionProperties.java | 121 +++++++++++++
 src/test/resources/pom.xml                         |  72 ++++++++
 src/test/units-files/reflection-test.properties    |  22 +++
 13 files changed, 1051 insertions(+)

diff --git a/.classpath b/.classpath
new file mode 100755
index 0000000..c10b3b7
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,21 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="src" path="target/maven-shared-archive-resources" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-utils/1.4.9/plexus-utils-1.4.9.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.jar"/>
+</classpath>
\ No newline at end of file
diff --git a/.project b/.project
new file mode 100755
index 0000000..26aa53c
--- /dev/null
+++ b/.project
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>maven-filtering</name>
+  <comment>Maven shared components</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..4f8e077
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+#Sun Jan 20 22:27:40 CET 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.4
+org.eclipse.jdt.core.compiler.compliance=1.4
diff --git a/pom.xml b/pom.xml
new file mode 100755
index 0000000..a5eff30
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,76 @@
+<?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="http://maven.apache.org/POM/4.0.0" 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">
+
+  <parent>
+    <groupId>org.apache.maven.shared</groupId>
+    <artifactId>maven-shared-components</artifactId>
+    <version>8</version>
+  </parent>
+
+  <prerequisites>
+    <maven>2.0.6</maven>
+  </prerequisites>
+  
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.shared</groupId>
+  <artifactId>maven-filtering</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-alpha-1-SNAPSHOT</version>
+	
+  <name>Maven Files Filtering</name>
+	
+  <scm>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-interpolation</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-interpolation</developerConnection>
+    <url>http://svn.apache.org/viewcvs.cgi/maven/sandbox/trunk/shared/maven-interpolation</url>
+  </scm>	
+	
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <version>1.3.4</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+	
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.4.9</version>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java b/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
new file mode 100755
index 0000000..c29a86c
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
@@ -0,0 +1,140 @@
+package org.apache.maven.shared.filtering;
+
+/*
+ * 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.IOException;
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A Map composed with some others (optional adding SystemProperties and envvar)
+ * The get Method look in the Map list to return the corresponding value
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 15 janv. 08
+ * @version $Id$
+ */
+public class CompositeMap
+    extends AbstractMap
+{
+    
+    private List /*Map*/maps;
+
+    private boolean systemPropertiesFirst;
+
+    /**
+     * Ca
+     * @param maps
+     * @throws IOException if getting envvars failed
+     */
+    public CompositeMap( List /* Map */maps )
+    {
+        this( maps, false, false );
+    }
+
+    /**
+     * @param maps an orderer {@link List} of {@link Map}
+     * @param useSystemProperties using or not the System Properties
+     * @param systemPropertiesFirst if with get( key ) the systemProperties must wins (the internal ordered {@link List} 
+     *        will have in first the System Properties)
+     */
+    public CompositeMap( List /*Map*/maps, boolean useSystemProperties, boolean systemPropertiesFirst )
+    {
+        this.systemPropertiesFirst = systemPropertiesFirst;
+        if ( systemPropertiesFirst && !useSystemProperties )
+        {
+            throw new IllegalArgumentException( "systemPropertiesFirst can't be true if useSystemProperties is false" );
+        }
+        this.maps = new ArrayList();
+        if ( useSystemProperties && !systemPropertiesFirst )
+        {
+            if ( maps != null )
+            {
+                this.maps.addAll( maps );
+            }
+            this.maps.add( System.getProperties() );
+        }
+        else if ( useSystemProperties && systemPropertiesFirst )
+        {
+            this.maps.add( System.getProperties() );
+            if ( maps != null )
+            {
+                this.maps.addAll( maps );
+            }
+        }
+        else
+        {
+            if ( maps != null )
+            {
+                this.maps.addAll( maps );
+            }
+        }
+    }
+
+    public Object get( Object key )
+    {
+        if ( this.maps != null )
+        {
+            for ( Iterator iterator = this.maps.iterator(); iterator.hasNext(); )
+            {
+                Map map = (Map) iterator.next();
+                Object value = map.get( key );
+                if ( value != null )
+                {
+                    return value;
+                }
+            }
+        }
+        return null;
+    }
+
+    /** 
+     * @see java.util.AbstractMap#entrySet()
+     */
+    public Set entrySet()
+    {
+        throw new UnsupportedOperationException( "Cannot enumerate properties in a composite map" );
+    }
+
+    public List getMaps()
+    {
+        return maps;
+    }
+
+    public void addMap( Map map )
+    {
+        // see constructors internal Map can't be null
+        this.maps.add( map );
+    }
+
+    public boolean isSystemPropertiesFirst()
+    {
+        return systemPropertiesFirst;
+    }
+
+    public void setSystemPropertiesFirst( boolean systemPropertiesFirst )
+    {
+        this.systemPropertiesFirst = systemPropertiesFirst;
+    }
+
+}
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
new file mode 100755
index 0000000..b6551dc
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.InterpolationFilterReader;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 22 janv. 08
+ * @version $Id$
+ * 
+ * @plexus.component role="org.apache.maven.shared.filtering.MavenFileFilter" role-hint="default"
+ */
+public class DefaultMavenFileFilter
+    implements MavenFileFilter
+{
+
+    /** 
+     * @see org.apache.maven.shared.filtering.MavenFileFilter#copyFile(java.io.File, java.io.File, boolean, org.apache.maven.project.MavenProject, java.util.List)
+     */
+    public void copyFile( File from, File to, boolean filtering, MavenProject mavenProject, List filters,
+                          boolean escapedBackslashesInFilePath, String encoding )
+        throws MavenFilteringException
+    {
+        List filterWrappers = getDefaultFilterWrappers( mavenProject, filters, escapedBackslashesInFilePath );
+        copyFile( from, to, filtering, filterWrappers, encoding );
+    }
+
+    /** 
+     * @see org.apache.maven.shared.filtering.MavenFileFilter#copyFile(java.io.File, java.io.File, boolean, java.util.List)
+     */
+    public void copyFile( File from, File to, boolean filtering, List filterWrappers, String encoding )
+        throws MavenFilteringException
+    {
+
+        try
+        {
+            if ( filtering )
+            {
+                FileUtils.FilterWrapper[] wrappers = (FileUtils.FilterWrapper[]) filterWrappers
+                    .toArray( new FileUtils.FilterWrapper[filterWrappers.size()] );
+                FileUtils.copyFile( from, to, encoding, wrappers );
+            }
+            else
+            {
+                FileUtils.copyFile( from, to, encoding, new FileUtils.FilterWrapper[0] );
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new MavenFilteringException( e.getMessage(), e );
+        }
+
+    }
+
+    /** 
+     * @see org.apache.maven.shared.filtering.MavenFileFilter#getDefaultFilterWrappers(org.apache.maven.project.MavenProject, java.util.List)
+     */
+    public List getDefaultFilterWrappers( final MavenProject mavenProject, List filters, final boolean escapedBackslashesInFilePath )
+        throws MavenFilteringException
+    {
+        
+        final Properties filterProperties = new Properties();
+
+        // System properties
+        filterProperties.putAll( System.getProperties() );
+
+        // Project properties
+        filterProperties.putAll( mavenProject.getProperties() );
+
+        // Take a copy of filterProperties to ensure that evaluated filterTokens are not propagated
+        // to subsequent filter files. NB this replicates current behaviour and seems to make sense.
+        final Properties baseProps = new Properties();
+        baseProps.putAll( filterProperties );
+
+        if ( filters != null )
+        {
+            for ( Iterator i = filters.iterator(); i.hasNext(); )
+            {
+                String filtersfile = (String) i.next();
+                try
+                {
+
+                    Properties properties = PropertyUtils.loadPropertyFile( new File( filtersfile ), baseProps );
+                    filterProperties.putAll( properties );
+                }
+                catch ( IOException e )
+                {
+                    throw new MavenFilteringException( "Error loading property file '" + filtersfile + "'", e );
+                }
+            }
+        }
+        
+        List defaultFilterWrappers = new ArrayList(3);
+        
+        // support ${token}
+        FileUtils.FilterWrapper one = new FileUtils.FilterWrapper() {
+            public Reader getReader(Reader reader) {
+                return new InterpolationFilterReader(reader, filterProperties, "${", "}");
+            }
+        };
+        defaultFilterWrappers.add( one );
+        
+        // support @token@
+        FileUtils.FilterWrapper second = new FileUtils.FilterWrapper() {
+            public Reader getReader(Reader reader) {
+                return new InterpolationFilterReader(reader, filterProperties, "@", "@");
+            }
+        };
+        defaultFilterWrappers.add( second );
+        // support ${token} with mavenProject reflection
+        FileUtils.FilterWrapper third = new FileUtils.FilterWrapper()
+        {
+            public Reader getReader( Reader reader )
+            {
+                ReflectionProperties reflectionProperties = new ReflectionProperties( mavenProject,
+                                                                                      escapedBackslashesInFilePath );
+                return new InterpolationFilterReader( reader, reflectionProperties, "${", "}" );
+            }
+        };
+        defaultFilterWrappers.add( third );
+        
+        
+        return defaultFilterWrappers;
+    }
+
+}
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
new file mode 100755
index 0000000..e8f32ff
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 22 janv. 08
+ * @version $Id$
+ */
+public interface MavenFileFilter
+{
+    
+    /**
+     * Will copy a file with some filtering using defaultFilterWrappers 
+     * @see #getDefaultFilterWrappers(MavenProject, List)
+     * 
+     * @param from file to copy/filter
+     * @param to destination file
+     * @param filtering enable or not filering
+     * @param mavenProject the mavenproject
+     * @param filters {@link List} of properties file 
+     * @throws IOException 
+     */
+    public void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject,
+                          List/* File */filters, boolean escapedBackslashesInFilePath, String encoding )
+        throws MavenFilteringException;
+
+    /**
+     * @param from
+     * @param to
+     * @param filtering
+     * @param filterWrappers
+     * @throws MavenFilteringException
+     */
+    public void copyFile( File from, final File to, boolean filtering, List /*FileUtils.FilterWrapper*/filterWrappers, String encoding )
+        throws MavenFilteringException;
+
+    /**
+     * 
+     * Will return the default FileUtils.FilterWrappers
+     * 
+     * <ul>
+     *   <li>interpolation with token ${ } and values from System.getProperties, project.getProperties and from filters.</li>
+     *   <li>interpolation with token @ @ and values from System.getProperties, project.getProperties and from filters.</li>
+     *   <li>interpolation with token ${ } and values from mavenProject interpolation.</li>
+     * </ul>
+     * 
+     * @param mavenProject
+     * @param filters {@link List} of properties file
+     * 
+     * @return {@link List} of FileUtils.FilterWrapper 
+     * 
+     */
+    public List/*FileUtils.FilterWrapper*/getDefaultFilterWrappers( MavenProject mavenProject, List/* File */filters,
+                                                                     boolean escapedBackslashesInFilePath )
+        throws MavenFilteringException;
+}
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java b/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java
new file mode 100755
index 0000000..25cb808
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 22 janv. 08
+ * @version $Id$
+ */
+public class MavenFilteringException
+    extends Exception
+{
+
+    /**
+     * 
+     */
+    public MavenFilteringException()
+    {
+        // nothing
+    }
+
+    /**
+     * @param message
+     */
+    public MavenFilteringException( String message )
+    {
+        super( message );
+    }
+
+    /**
+     * @param cause
+     */
+    public MavenFilteringException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    /**
+     * @param message
+     * @param cause
+     */
+    public MavenFilteringException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+}
diff --git a/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
new file mode 100755
index 0000000..424d689
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
@@ -0,0 +1,199 @@
+package org.apache.maven.shared.filtering;
+
+/*
+ * 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 org.codehaus.plexus.util.IOUtil;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Properties;
+
+
+/**
+ * @author <a href="mailto:kenney@neonics.com">Kenney Westerhof</a>
+ * @author William Ferguson
+ * @version $Id$
+ */
+public final class PropertyUtils
+{
+    private PropertyUtils()
+    {
+        // prevent instantiation
+    }
+
+    /**
+     * Reads a property file, resolving all internal variables, using the supplied base properties.
+     * <p>
+     * The properties are resolved iteratively, so if the value of property A refers to property B, then after resolution
+     * the value of property B will contain the value of property B.
+     * </p>
+     * 
+     * @param propFile The property file to load.
+     * @param baseProps Properties containing the initial values to subsitute into the properties file.
+     * @return Properties object containing the properties in the file with their values fully resolved.
+     * @throws IOException if profile does not exist, or cannot be read.
+     */
+    public static Properties loadPropertyFile( File propFile, Properties baseProps )
+        throws IOException
+    {
+        if ( !propFile.exists() )
+        {
+            throw new FileNotFoundException( propFile.toString() );
+        }
+
+        final Properties fileProps = new Properties();
+        final FileInputStream inStream = new FileInputStream( propFile );
+        try
+        {
+            fileProps.load( inStream );
+        }
+        finally
+        {
+            IOUtil.close( inStream );
+        }
+
+        final Properties combinedProps = new Properties();
+        combinedProps.putAll( baseProps );
+        combinedProps.putAll( fileProps );
+
+        // The algorithm iterates only over the fileProps which is all that is required to resolve
+        // the properties defined within the file. This is slighlty different to current, however
+        // I suspect that this was the actual original intent.
+        // 
+        // The difference is that #loadPropertyFile(File, boolean, boolean) also resolves System properties
+        // whose values contain expressions. I believe this is unexpected and is not validated by the test cases,
+        // as can be verified by replacing the implementation of #loadPropertyFile(File, boolean, boolean)
+        // with the commented variant I have provided that reuses this method.
+
+        for ( Iterator iter = fileProps.keySet().iterator(); iter.hasNext(); )
+        {
+            final String k = (String) iter.next();
+            final String propValue = getPropertyValue( k, combinedProps );
+            fileProps.setProperty( k, propValue );
+        }
+
+        return fileProps;
+    }
+
+    /**
+     * Reads a property file, resolving all internal variables.
+     *
+     * @param propfile The property file to load
+     * @param fail wheter to throw an exception when the file cannot be loaded or to return null
+     * @param useSystemProps wheter to incorporate System.getProperties settings into the returned Properties object.
+     * @return the loaded and fully resolved Properties object
+     */
+    public static Properties loadPropertyFile( File propfile, boolean fail, boolean useSystemProps )
+        throws IOException
+    {
+        
+        final Properties baseProps = new Properties();
+
+        if (useSystemProps) 
+        {
+            baseProps.putAll(System.getProperties());
+        }
+
+        final Properties resolvedProps = new Properties();
+        try 
+        {
+            resolvedProps.putAll(loadPropertyFile(propfile, baseProps));
+        } catch (FileNotFoundException e)
+        {
+            if (fail) 
+            {
+                throw new FileNotFoundException(propfile.toString());
+            }
+        }
+
+        if (useSystemProps) 
+        {
+            resolvedProps.putAll(baseProps);
+        }
+
+        return resolvedProps;
+    }
+
+
+    /**
+     * Retrieves a property value, replacing values like ${token}
+     * using the Properties to look them up.
+     *
+     * It will leave unresolved properties alone, trying for System
+     * properties, and implements reparsing (in the case that
+     * the value of a property contains a key), and will
+     * not loop endlessly on a pair like
+     * test = ${test}.
+     */
+    private static String getPropertyValue( String k, Properties p )
+    {
+        // This can also be done using InterpolationFilterReader,
+        // but it requires reparsing the file over and over until
+        // it doesn't change.
+
+        String v = p.getProperty( k );
+        String ret = "";
+        int idx, idx2;
+
+        while ( ( idx = v.indexOf( "${" ) ) >= 0 )
+        {
+            // append prefix to result
+            ret += v.substring( 0, idx );
+
+            // strip prefix from original
+            v = v.substring( idx + 2 );
+
+            // if no matching } then bail
+            if ( ( idx2 = v.indexOf( '}' ) ) < 0 )
+            {
+                break;
+            }
+
+            // strip out the key and resolve it
+            // resolve the key/value for the ${statement}
+            String nk = v.substring( 0, idx2 );
+            v = v.substring( idx2 + 1 );
+            String nv = p.getProperty( nk );
+
+            // try global environment..
+            if ( nv == null )
+            {
+                nv = System.getProperty( nk );
+            }
+
+            // if the key cannot be resolved,
+            // leave it alone ( and don't parse again )
+            // else prefix the original string with the
+            // resolved property ( so it can be parsed further )
+            // taking recursion into account.
+            if ( nv == null || nv.equals( k ) )
+            {
+                ret += "${" + nk + "}";
+            }
+            else
+            {
+                v = nv + v;
+            }
+        }
+        return ret + v;
+    }
+}
diff --git a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
new file mode 100755
index 0000000..a6d9ef9
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
@@ -0,0 +1,87 @@
+package org.apache.maven.shared.filtering;
+
+/*
+ * 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.util.AbstractMap;
+import java.util.Set;
+
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
+
+
+/**
+ * @author Andreas Hoheneder (ahoh_at_inode.at)
+ * @version $Id$
+ */
+public class ReflectionProperties
+    extends AbstractMap
+{
+
+    private MavenProject project;
+
+    boolean escapedBackslashesInFilePath;
+
+    public ReflectionProperties( MavenProject mavenProject  ) 
+    {
+       this(mavenProject, false);
+    }    
+    
+    public ReflectionProperties( MavenProject mavenProject, boolean escapedBackslashesInFilePath ) 
+    {
+       super();
+
+       project = mavenProject;
+
+       this.escapedBackslashesInFilePath = escapedBackslashesInFilePath;
+    }
+    
+    public Object get( Object key )
+    {
+        Object value = null;
+        try 
+        {
+            value = ReflectionValueExtractor.evaluate( "" + key , project );
+
+            if ( escapedBackslashesInFilePath && value != null &&
+                "java.lang.String".equals( value.getClass().getName() ) )
+            {
+                String val = (String) value;
+
+                // Check if it's a windows path
+                if ( val.indexOf( ":\\" ) == 1 )
+                {
+                    value = StringUtils.replace( (String)value, "\\", "\\\\" );
+                    value = StringUtils.replace( (String)value, ":", "\\:" );
+                }
+            }
+        }
+        catch ( Exception e ) 
+        {
+            //TODO: remove the try-catch block when ReflectionValueExtractor.evaluate() throws no more exceptions
+        } 
+        return value;
+    }
+    
+    public Set entrySet()
+    {
+        throw new UnsupportedOperationException( "Cannot enumerate properties in a project" );
+    }    
+}
diff --git a/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
new file mode 100755
index 0000000..e0a7077
--- /dev/null
+++ b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.PlexusTestCase;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 22 janv. 08
+ * @version $Id$
+ */
+public class TestReflectionProperties
+    extends PlexusTestCase
+{
+
+    public void testSimpleFiltering()
+        throws Exception
+    {
+        Properties allProperties = System.getProperties();
+        FileInputStream readFileInputStream = null;
+        try
+        {
+            MavenProject mavenProject = new MavenProject();
+            mavenProject.setVersion( "1.0" );
+            mavenProject.setGroupId( "org.apache" );
+            System.setProperty( "foo", "bar" );
+            MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" );
+
+            File from = new File( getBasedir() + "/src/test/units-files/reflection-test.properties" );
+            File to = new File( getBasedir() + "/target/reflection-test.properties" );
+
+            if (to.exists())
+            {
+                to.delete();
+            }            
+            
+            mavenFileFilter.copyFile( from, to, true, mavenProject, null, false, null );
+
+            Properties reading = new Properties();
+            readFileInputStream = new FileInputStream( to );
+            reading.load( readFileInputStream );
+            assertEquals( "1.0", reading.get( "version" ) );
+            assertEquals( "org.apache", reading.get( "groupId" ) );
+            assertEquals( "bar", reading.get( "foo" ) );
+            assertEquals( "none filtered", reading.get( "none" ) );
+        }
+        finally
+        {
+            if ( readFileInputStream != null )
+            {
+                readFileInputStream.close();
+            }
+            System.setProperties( allProperties );
+        }
+
+    }
+
+    public void testSimpleNonFiltering()
+        throws Exception
+    {
+        Properties allProperties = System.getProperties();
+        FileInputStream readFileInputStream = null;
+        try
+        {
+            MavenProject mavenProject = new MavenProject();
+            mavenProject.setVersion( "1.0" );
+            mavenProject.setGroupId( "org.apache" );
+            System.setProperty( "foo", "bar" );
+            MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" );
+
+            File from = new File( getBasedir() + "/src/test/units-files/reflection-test.properties" );
+            File to = new File( getBasedir() + "/target/reflection-test.properties" );
+
+            if (to.exists())
+            {
+                to.delete();
+            }
+            
+            mavenFileFilter.copyFile( from, to, false, mavenProject, null, false, null );
+
+            Properties reading = new Properties();
+            readFileInputStream = new FileInputStream( to );
+            reading.load( readFileInputStream );
+            assertEquals( "${pom.version}", reading.get( "version" ) );
+            assertEquals( "${pom.groupId}", reading.get( "groupId" ) );
+            assertEquals( "${foo}", reading.get( "foo" ) );
+            assertEquals( "none filtered", reading.get( "none" ) );
+        }
+        finally
+        {
+            if ( readFileInputStream != null )
+            {
+                readFileInputStream.close();
+            }
+            System.setProperties( allProperties );
+        }
+
+    }    
+    
+}
diff --git a/src/test/resources/pom.xml b/src/test/resources/pom.xml
new file mode 100755
index 0000000..12f0265
--- /dev/null
+++ b/src/test/resources/pom.xml
@@ -0,0 +1,72 @@
+<?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="http://maven.apache.org/POM/4.0.0" 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">
+
+  <parent>
+    <groupId>org.apache.maven.shared</groupId>
+    <artifactId>maven-shared-components</artifactId>
+    <version>8</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.shared</groupId>
+  <artifactId>maven-filtering</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-alpha-1-SNAPSHOT</version>
+	
+  <name>Maven Files Filtering</name>
+	
+  <scm>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-interpolation</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-interpolation</developerConnection>
+    <url>http://svn.apache.org/viewcvs.cgi/maven/sandbox/trunk/shared/maven-interpolation</url>
+  </scm>	
+	
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <version>1.3.4</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+	
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.4.9</version>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/src/test/units-files/reflection-test.properties b/src/test/units-files/reflection-test.properties
new file mode 100755
index 0000000..022a0a0
--- /dev/null
+++ b/src/test/units-files/reflection-test.properties
@@ -0,0 +1,22 @@
+#/*
+# * 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.
+# */
+version=${pom.version}
+groupId=${pom.groupId}
+foo=${foo}
+none=none filtered
\ No newline at end of file


[maven-filtering] 22/44: replace using System.getProperties() with mavenSession.getExecutionProperties()

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 60725beadc42645a23b0720910ad0239f73dd556
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Feb 25 10:51:37 2008 +0000

    replace using System.getProperties() with mavenSession.getExecutionProperties()
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@630802 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  5 ++++
 .../shared/filtering/DefaultMavenFileFilter.java   | 28 ++++++++++++++--------
 .../filtering/DefaultMavenResourcesFiltering.java  |  5 ++--
 .../maven/shared/filtering/MavenFileFilter.java    |  6 +++--
 .../shared/filtering/MavenResourcesFiltering.java  |  3 ++-
 .../DefaultMavenResourcesFilteringTest.java        | 10 +++++---
 .../shared/filtering/TestReflectionProperties.java |  4 ++--
 7 files changed, 41 insertions(+), 20 deletions(-)

diff --git a/pom.xml b/pom.xml
index a5eff30..f3d17cf 100755
--- a/pom.xml
+++ b/pom.xml
@@ -67,6 +67,11 @@
       <version>2.0.6</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>2.0.6</version>
+    </dependency>    
+    <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
       <version>1.4.9</version>
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index 848a257..30f8dc7 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -28,6 +28,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.InterpolationFilterReader;
@@ -45,10 +46,10 @@ public class DefaultMavenFileFilter
 {
 
     public void copyFile( File from, File to, boolean filtering, MavenProject mavenProject, List filters,
-                          boolean escapedBackslashesInFilePath, String encoding )
+                          boolean escapedBackslashesInFilePath, String encoding, MavenSession mavenSession )
         throws MavenFilteringException
     {
-        List filterWrappers = getDefaultFilterWrappers( mavenProject, filters, escapedBackslashesInFilePath );
+        List filterWrappers = getDefaultFilterWrappers( mavenProject, filters, escapedBackslashesInFilePath, mavenSession );
         copyFile( from, to, filtering, filterWrappers, encoding );
     }
 
@@ -77,7 +78,7 @@ public class DefaultMavenFileFilter
     }
 
     public List getDefaultFilterWrappers( final MavenProject mavenProject, List filters,
-                                          final boolean escapedBackslashesInFilePath )
+                                          final boolean escapedBackslashesInFilePath, MavenSession mavenSession )
         throws MavenFilteringException
     {
         
@@ -91,9 +92,14 @@ public class DefaultMavenFileFilter
 
         // Project properties
         baseProps.putAll( mavenProject.getProperties() == null ? Collections.EMPTY_MAP : mavenProject
-            .getProperties() );        
-        // System properties wins
-        baseProps.putAll( System.getProperties() );         
+            .getProperties() );    
+        // TODO this is NPE free but do we consider this as normal
+        // or do we have to throw an MavenFilteringException with mavenSession cannot be null
+        if ( mavenSession != null )
+        {
+            // execution properties wins
+            baseProps.putAll( mavenSession.getExecutionProperties() );
+        }
         
         // now we build properties to use for resources interpolation
         
@@ -107,10 +113,12 @@ public class DefaultMavenFileFilter
 
         // Project properties
         filterProperties.putAll( mavenProject.getProperties() == null ? Collections.EMPTY_MAP : mavenProject
-            .getProperties() );        
-        // System properties wins
-        filterProperties.putAll( System.getProperties() );        
-        
+            .getProperties() );     
+        if ( mavenSession != null )
+        {
+            // execution properties wins
+            filterProperties.putAll( mavenSession.getExecutionProperties() );
+        }
         
         List defaultFilterWrappers = new ArrayList( 3 );
 
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index 3449e2f..b4df098 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -25,6 +25,7 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
@@ -75,10 +76,10 @@ public class DefaultMavenResourcesFiltering
     private MavenFileFilter mavenFileFilter;
     
     public void filterResources( List resources, File outputDirectory, MavenProject mavenProject, String encoding,
-                                 List fileFilters, List nonFilteredFileExtensions )
+                                 List fileFilters, List nonFilteredFileExtensions, MavenSession mavenSession )
         throws MavenFilteringException
     {
-        List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, fileFilters, true );
+        List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, fileFilters, true, mavenSession );
 
         filterResources( resources, outputDirectory, encoding, filterWrappers, mavenProject.getBasedir(),
                          nonFilteredFileExtensions );
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index 8c17c08..b525918 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -22,7 +22,9 @@ package org.apache.maven.shared.filtering;
 import java.io.File;
 import java.util.List;
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.MavenSettingsBuilder;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -44,7 +46,7 @@ public interface MavenFileFilter
      * @throws IOException 
      */
     void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject, List filters,
-                          boolean escapedBackslashesInFilePath, String encoding )
+                          boolean escapedBackslashesInFilePath, String encoding, MavenSession mavenSession )
         throws MavenFilteringException;
 
     /**
@@ -73,6 +75,6 @@ public interface MavenFileFilter
      * @return {@link List} of FileUtils.FilterWrapper 
      * 
      */
-    List getDefaultFilterWrappers( MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath )
+    List getDefaultFilterWrappers( MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath, MavenSession mavenSession )
         throws MavenFilteringException;
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
index 498b936..4e6998a 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -22,6 +22,7 @@ package org.apache.maven.shared.filtering;
 import java.io.File;
 import java.util.List;
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
 
 /**
@@ -42,7 +43,7 @@ public interface MavenResourcesFiltering
      * @throws MavenFilteringException
      */
     void filterResources( List resources, File outputDirectory, MavenProject mavenProject, String encoding,
-                          List fileFilters, List nonFilteredFileExtensions )
+                          List fileFilters, List nonFilteredFileExtensions, MavenSession mavenSession )
         throws MavenFilteringException;
 
     /**
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index 059eff8..383b27f 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -28,6 +28,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
@@ -88,7 +89,9 @@ public class DefaultMavenResourcesFilteringTest
         filtersFile.add( getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
         
         List nonFilteredFileExtensions = Collections.singletonList( "gif" );
-        mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, filtersFile, nonFilteredFileExtensions );
+        
+        mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, filtersFile,
+                                                 nonFilteredFileExtensions, new StubMavenSession() );
        
         assertEquals( 3, outputDirectory.listFiles().length );
         Properties result = PropertyUtils.loadPropertyFile( new File(outputDirectory, "empty-maven-resources-filtering.txt"), null );
@@ -147,7 +150,8 @@ public class DefaultMavenResourcesFilteringTest
         List nonFilteredFileExtensions = Collections.singletonList( "gif" );
         
         MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" );
-        List defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, null, true );
+        List defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, null, true,
+                                                                               new StubMavenSession() );
 
         List filterWrappers = new ArrayList( );
         filterWrappers.addAll( defaultFilterWrappers );
@@ -188,7 +192,7 @@ public class DefaultMavenResourcesFilteringTest
         resource.setDirectory( unitFilesDir );
         resource.setFiltering( false );
         mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, null,
-                                                 Collections.EMPTY_LIST );
+                                                 Collections.EMPTY_LIST, new StubMavenSession() );
 
         assertEquals( 3, outputDirectory.listFiles().length );
         Properties result = PropertyUtils.loadPropertyFile( new File( outputDirectory,
diff --git a/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
index 4784f6e..dc8a510 100755
--- a/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
+++ b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
@@ -56,7 +56,7 @@ public class TestReflectionProperties
                 to.delete();
             }            
             
-            mavenFileFilter.copyFile( from, to, true, mavenProject, null, false, null );
+            mavenFileFilter.copyFile( from, to, true, mavenProject, null, false, null, new StubMavenSession() );
 
             Properties reading = new Properties();
             readFileInputStream = new FileInputStream( to );
@@ -98,7 +98,7 @@ public class TestReflectionProperties
                 to.delete();
             }
             
-            mavenFileFilter.copyFile( from, to, false, mavenProject, null, false, null );
+            mavenFileFilter.copyFile( from, to, false, mavenProject, null, false, null, new StubMavenSession() );
 
             Properties reading = new Properties();
             readFileInputStream = new FileInputStream( to );


[maven-filtering] 31/44: fix scm info

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 313cde1b98d9923084238fc57b335889777bee50
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Wed Feb 27 23:42:08 2008 +0000

    fix scm info
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@631773 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index f3d17cf..8f2f3c6 100755
--- a/pom.xml
+++ b/pom.xml
@@ -38,9 +38,9 @@
   <name>Maven Files Filtering</name>
 	
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-interpolation</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-interpolation</developerConnection>
-    <url>http://svn.apache.org/viewcvs.cgi/maven/sandbox/trunk/shared/maven-interpolation</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering</developerConnection>
+    <url>http://svn.apache.org/viewcvs.cgi/maven/sandbox/trunk/shared/maven-filtering</url>
   </scm>	
 	
   <build>


[maven-filtering] 44/44: [maven-release-plugin] copy for tag maven-filtering-1.0-alpha-1

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 220573947fc7aae6efb2f1bbcdfece391e0d0233
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Tue Jul 29 22:18:17 2008 +0000

    [maven-release-plugin]  copy for tag maven-filtering-1.0-alpha-1
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/shared/tags/maven-filtering-1.0-alpha-1@680861 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 26d9eae..5591bd8 100755
--- a/pom.xml
+++ b/pom.xml
@@ -33,14 +33,14 @@
   <groupId>org.apache.maven.shared</groupId>
   <artifactId>maven-filtering</artifactId>
   <packaging>jar</packaging>
-  <version>1.0-alpha-1-SNAPSHOT</version>
+  <version>1.0-alpha-1</version>
 	
   <name>Maven Files Filtering</name>
 	
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering</developerConnection>
-    <url>http://svn.apache.org/viewcvs.cgi/maven/sandbox/trunk/shared/maven-filtering</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/maven/shared/tags/maven-filtering-1.0-alpha-1</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/shared/tags/maven-filtering-1.0-alpha-1</developerConnection>
+    <url>http://svn.apache.org/viewcvs.cgi/maven/shared/tags/maven-filtering-1.0-alpha-1</url>
   </scm>	
 	
   <build>


[maven-filtering] 14/44: start a simple documentation

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 4d2cb1414a337c7e2c73954fc4b0f47339e554c2
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Feb 9 23:26:31 2008 +0000

    start a simple documentation
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@620216 13f79535-47bb-0310-9956-ffa450edef68
---
 src/site/apt/index.apt                             | 52 ++++++++++++++++++
 src/site/site.xml                                  | 64 ++++++++++++++++++++++
 .../DefaultMavenResourcesFilteringTest.java        |  4 +-
 .../maven-resources-filtering.txt                  |  3 +-
 4 files changed, 121 insertions(+), 2 deletions(-)

diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
new file mode 100755
index 0000000..5a1354c
--- /dev/null
+++ b/src/site/apt/index.apt
@@ -0,0 +1,52 @@
+ ------
+ Reference
+ ------
+ Olivier Lamy
+ ------
+ 2008-01-01
+ ------
+
+ ~~ 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.
+
+Maven Filtering Component
+
+  This Plexus components has been build with the filtering process coming from the maven-resources-plugin.
+  
+  The goal is to provide a common way for all plugins which needs to filtering resources. 
+  
+* Component MavenResourcesFiltering
+
+  This component will apply filtering on a List of org.apache.maven.model.Resource. 
+  The method without the filterWrappers parameter will interpolate the files using the default FileUtils.FilterWrapper. 
+
+* Component MavenFileFilter
+
+  This component has a method which returns the default FileUtils.FilterWrapper.
+  This are :
+  
+    * interpolation with token ${ } and values from SystemProps, project.properties, filters, project.filters and project.build.filters
+    
+    * interpolation with token @ @ and values from SystemProps, project.properties, filters, project.filters and project.build.filters
+    
+    * interpolation with token ${ } and values from mavenProject interpolation
+    
+    []
+    
+    <<NOTE>> : The sentence "values from SystemProps, project.properties, filters, project.filters and project.build.filters" 
+    means pairs of key/value will be loaded/overriding with this order. The value for key java.version can be overriding 
+    with a property in the maven project (yes crazy but possible).
\ No newline at end of file
diff --git a/src/site/site.xml b/src/site/site.xml
new file mode 100755
index 0000000..4afb631
--- /dev/null
+++ b/src/site/site.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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>
+  <!-- TODO: Most of the stuff in this file should be inherited from the shared parent -->
+  <!-- TODO: banners, skin, publish date, version should be inherited from Maven itself -->
+  <bannerLeft>
+    <name>${project.name}</name>
+    <src>http://maven.apache.org/images/apache-maven-project-2.png</src>
+    <href>http://maven.apache.org/</href>
+  </bannerLeft>
+  <bannerRight>
+    <src>http://maven.apache.org/images/maven-logo-2.gif</src>
+  </bannerRight>
+  <skin>
+    <groupId>org.apache.maven.skins</groupId>
+    <artifactId>maven-stylus-skin</artifactId>
+  </skin>
+  <publishDate format="dd MMM yyyy" position="left" />
+  <version position="left" />
+  <body>
+    <menu name="Overview">
+      <item name="Reference" href="index.html"/>
+    </menu>
+    <!-- TODO: Link, head, reports should be inherited -->
+    <!-- TODO: use breadcrumbs more structure, links for links, and inherit subprojects as a menu or not at all -->
+    <links>
+      <item name="Apache" href="http://www.apache.org/"/>
+      <item name="Maven 1.x" href="http://maven.apache.org/maven-1.x"/>
+      <item name="Maven 2.x" href="http://maven.apache.org/"/>
+      <item name="Maven 2.x Plugins" href="http://maven.apache.org/plugins/"/>
+      <item name="Continuum" href="http://maven.apache.org/continuum"/>
+      <item name="SCM" href="http://maven.apache.org/scm"/>
+      <item name="Wagon" href="http://maven.apache.org/wagon"/>
+      <item name="JXR" href="http://maven.apache.org/jxr"/>
+      <item name="Doxia" href="http://maven.apache.org/doxia"/>
+    </links>
+    <head>
+      <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+      </script>
+      <script type="text/javascript">
+        _uacct = "UA-140879-1";
+        urchinTracker();
+      </script>
+    </head>
+    <menu ref="reports" inherit="bottom" />
+  </body>
+</project>
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index b8d3fce..b956042 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -60,7 +60,8 @@ public class DefaultMavenResourcesFilteringTest
         mavenProject.setGroupId( "org.apache" );
 
         Properties projectProperties = new Properties();
-        projectProperties.put( "foo", "bar" );     
+        projectProperties.put( "foo", "bar" );
+        projectProperties.put( "java.version", "zloug" );
         mavenProject.setProperties( projectProperties );
         MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
             .getName() );
@@ -88,6 +89,7 @@ public class DefaultMavenResourcesFilteringTest
         
         assertEquals( "@@", result.getProperty( "emptyexpression" ) );
         assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
+        assertEquals( "zloug", result.getProperty( "javaVersion" ) );
     }
     
     public void testNoFiltering()
diff --git a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
index 3826b6f..47eaa4e 100755
--- a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
+++ b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
@@ -22,4 +22,5 @@ foo=${foo}
 none=none filtered
 base=${pom.basedir}
 emptyexpression=@@
-emptyexpression2=${}
\ No newline at end of file
+emptyexpression2=${}
+javaVersion=${java.version}
\ No newline at end of file


[maven-filtering] 32/44: skip empty file name

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 98f60d828676bc3ad4e61ac2b22a3e56e0552c75
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Mar 1 00:57:57 2008 +0000

    skip empty file name
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@632519 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/maven/shared/filtering/DefaultMavenFileFilter.java   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index 30f8dc7..eadefb0 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -32,6 +32,7 @@ import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.InterpolationFilterReader;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -165,6 +166,11 @@ public class DefaultMavenFileFilter
             for ( Iterator iterator = propertiesFilePaths.iterator(); iterator.hasNext(); )
             {
                 String filterFile = (String) iterator.next();
+                if (StringUtils.isEmpty( filterFile ))
+                {
+                    // skip empty file name
+                    continue;
+                }
                 try
                 {
                     // TODO new File should be new File(mavenProject.getBasedir(), filterfile ) ? 


[maven-filtering] 29/44: add filterWrappers coming from the execution configuration bean update documentation

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 7465c47a36d62e51173d188b9a4182538a3a5f86
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Wed Feb 27 22:58:39 2008 +0000

    add filterWrappers coming from the execution configuration bean
    update documentation
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@631768 13f79535-47bb-0310-9956-ffa450edef68
---
 .../filtering/DefaultMavenResourcesFiltering.java  | 19 +++++++++----
 src/site/apt/usage.apt                             | 33 ++++++++++++++--------
 .../DefaultMavenResourcesFilteringTest.java        | 18 ++++++------
 3 files changed, 43 insertions(+), 27 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index 05706d4..b0257c4 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -138,10 +138,15 @@ public class DefaultMavenResourcesFiltering
         
         if ( mavenResourcesExecution.isUseDefaultFilterWrappers() )
         {
-            List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenResourcesExecution.getMavenProject(),
-                                                                            mavenResourcesExecution.getFileFilters(),
-                                                                            true, mavenResourcesExecution
-                                                                                .getMavenSession() );
+            List filterWrappers = new ArrayList();
+            if ( mavenResourcesExecution.getFilterWrappers() != null )
+            {
+                filterWrappers.addAll( mavenResourcesExecution.getFilterWrappers() );
+            }
+            filterWrappers.addAll( mavenFileFilter.getDefaultFilterWrappers( mavenResourcesExecution.getMavenProject(),
+                                                                             mavenResourcesExecution.getFileFilters(),
+                                                                             true, mavenResourcesExecution
+                                                                                 .getMavenSession() ) );
             mavenResourcesExecution.setFilterWrappers( filterWrappers );
         }
 
@@ -209,8 +214,8 @@ public class DefaultMavenResourcesFiltering
 
             getLogger().info(
                               "Copying " + includedFiles.size() + " resource" + ( includedFiles.size() > 1 ? "s" : "" )
-                                  + ( targetPath == null ? "" : " to " + targetPath ) );            
-            
+                                  + ( targetPath == null ? "" : " to " + targetPath ) );
+
             for ( Iterator j = includedFiles.iterator(); j.hasNext(); )
             {
                 String name = (String) j.next();
@@ -230,8 +235,10 @@ public class DefaultMavenResourcesFiltering
                 {
                     destinationFile.getParentFile().mkdirs();
                 }
+                
                 boolean filteredExt = filteredFileExtension( source.getName(), mavenResourcesExecution
                     .getNonFilteredFileExtensions() );
+                
                 mavenFileFilter.copyFile( source, destinationFile, resource.isFiltering() && filteredExt,
                                           mavenResourcesExecution.getFilterWrappers(), mavenResourcesExecution
                                               .getEncoding() );
diff --git a/src/site/apt/usage.apt b/src/site/apt/usage.apt
index 3c28ce5..8c6a0bc 100755
--- a/src/site/apt/usage.apt
+++ b/src/site/apt/usage.apt
@@ -43,11 +43,24 @@ Maven Filtering Component Basic Usage
 
 +-----+
 
-encoding can be null platform default will be used
+resources : List of org.apache.maven.model.Resource
+
+outputDirectory : base output directory for Resource.targetPath
+
+mavenProject : a mavenProject 
+
+encoding : output encoding for filtered files (can be null platform default will be used)
+
+filtersFile : List of String pointed to a properties file 
 
 nonFilteredFileExtensions : is a List of String which file extensions to not apply filtering (default List contains jpg,jpeg,gif,bmp,png)
 
-mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, encoding, filtersFile, nonFilteredFileExtensions, mavenSession );
+mavenSession : executionProperties will be used for file filtering
+
+MavenResourcesExecution mavenResourcesExecution = 
+  new MavenResourcesExecution ( resources, outputDirectory, mavenProject, encoding, filtersFile, nonFilteredFileExtensions, mavenSession );
+
+mavenResourcesFiltering.filterResources( mavenResourcesExecution );
 
 +-----+
 
@@ -58,11 +71,8 @@ mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProjec
 
 +-----+
 
-MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" );
-List defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, null, true, mavenSession );
+Create your FilterWrapper.
 
-List filterWrappers = new ArrayList( );
-filterWrappers.addAll( defaultFilterWrappers );
 FileUtils.FilterWrapper filterWrapper = new FileUtils.FilterWrapper()
 {
     public Reader getReader( Reader reader )
@@ -71,15 +81,14 @@ FileUtils.FilterWrapper filterWrapper = new FileUtils.FilterWrapper()
         return new InterpolationFilterReader( reader, reflectionProperties, "@", "@" );
     }
 };
-filterWrappers.add( filterWrapper );
 
-here you can apply filtering on your resources.
+Create your MavenResourcesExecution instance and add a new filterWrapper.
 
-encoding can be null platform default will be used
+mavenResourcesExecution.addFilterWrapper( filterWrapper ); 
+If the mavenResourcesExecution.useDefaultFilterWrappers is set to true default FilterWrapper will be added first. 
 
-nonFilteredFileExtensions : is a List of String which file extensions to not apply filtering (default List contains jpg,jpeg,gif,bmp,png)
+here you can apply filtering on your resources.
 
-mavenResourcesFiltering.filterResources( resources, outputDirectory, encoding, filterWrappers,
-                                         outputDirectory, nonFilteredFileExtensions, mavenSession );
+mavenResourcesFiltering.filterResources( mavenResourcesExecution );
 
 +-----+
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index dcf3e14..fe5a6a1 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -28,7 +28,9 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
+import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
@@ -194,12 +196,6 @@ public class DefaultMavenResourcesFilteringTest
 
         List nonFilteredFileExtensions = Collections.singletonList( "gif" );
 
-        MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" );
-        List defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, null, true,
-                                                                               new StubMavenSession() );
-
-        List filterWrappers = new ArrayList();
-        filterWrappers.addAll( defaultFilterWrappers );
         FileUtils.FilterWrapper filterWrapper = new FileUtils.FilterWrapper()
         {
             public Reader getReader( Reader reader )
@@ -208,9 +204,13 @@ public class DefaultMavenResourcesFilteringTest
                 return new InterpolationFilterReader( reader, reflectionProperties, "@", "@" );
             }
         };
-        filterWrappers.add( filterWrapper );
-        mavenResourcesFiltering.filterResources( resources, outputDirectory, null, filterWrappers,
-                                                 new File( getBasedir() ), nonFilteredFileExtensions );
+
+        MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory,
+                                                                                       mavenProject, null, null,
+                                                                                       nonFilteredFileExtensions,
+                                                                                       new StubMavenSession() );
+        mavenResourcesExecution.addFilterWrapper( filterWrapper );
+        mavenResourcesFiltering.filterResources( mavenResourcesExecution );
 
         Properties result = PropertyUtils
             .loadPropertyFile( new File( outputDirectory, "maven-resources-filtering.txt" ), null );


[maven-filtering] 41/44: add link in the documentation

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 9bd05a39b86393805d8c94dc7ca2ca8cc929ba03
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Tue Jul 29 21:38:07 2008 +0000

    add link in the documentation
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@680851 13f79535-47bb-0310-9956-ffa450edef68
---
 src/site/apt/usage.apt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/site/apt/usage.apt b/src/site/apt/usage.apt
index 740381f..96a674b 100755
--- a/src/site/apt/usage.apt
+++ b/src/site/apt/usage.apt
@@ -67,8 +67,8 @@ mavenResourcesFiltering.filterResources( mavenResourcesExecution );
 * Adding new filtering Token
 
   You must use the other methods from the MavenResourcesFiltering component and construct your own List of FilterWrapper.
-  The following example add the interpolation for the Token @ @ with using values coming from reflection with the Maven Project.
-  NOTE : the component maven-filtering use the plexus-interpolation component
+  The following example add the interpolation for the Token @ @ with using values coming from reflection with the Maven Project.\
+  NOTE : the component maven-filtering use the {{{http://plexus.codehaus.org/plexus-components/plexus-interpolation/}plexus-interpolation component}}.
 
 +-----+
 


[maven-filtering] 25/44: fix documentation add mavenSession parameter

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 0e49f4c2fe6d9206f4ece7986ffcd379a678f3b4
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Feb 25 21:59:28 2008 +0000

    fix documentation add mavenSession parameter
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@631015 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java | 2 +-
 src/site/apt/usage.apt                                               | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index b525918..72944d1 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -20,11 +20,11 @@ package org.apache.maven.shared.filtering;
  */
 
 import java.io.File;
+import java.io.IOException;
 import java.util.List;
 
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.settings.MavenSettingsBuilder;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
diff --git a/src/site/apt/usage.apt b/src/site/apt/usage.apt
index 3584ab5..142c364 100755
--- a/src/site/apt/usage.apt
+++ b/src/site/apt/usage.apt
@@ -59,7 +59,7 @@ mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProjec
 +-----+
 
 MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" );
-List defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, null, true );
+List defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, null, true, mavenSession );
 
 List filterWrappers = new ArrayList( );
 filterWrappers.addAll( defaultFilterWrappers );
@@ -80,6 +80,6 @@ encoding can be null platform default will be used
 nonFilteredFileExtensions : is a List of String which file extensions to not apply filtering (default List contains jpg,jpeg,gif,bmp,png)
 
 mavenResourcesFiltering.filterResources( resources, outputDirectory, encoding, filterWrappers,
-                                         outputDirectory, nonFilteredFileExtensions );
+                                         outputDirectory, nonFilteredFileExtensions, mavenSession );
 
 +-----+


[maven-filtering] 11/44: fix license header add junit

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit b711d73ab55ce045e1e8d4daca43adb2bb64c81f
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Fri Feb 8 22:49:37 2008 +0000

    fix license header
    add junit
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@620020 13f79535-47bb-0310-9956-ffa450edef68
---
 .../DefaultMavenResourcesFilteringTest.java        |  3 ++-
 .../maven/shared/filtering/PropertyUtilsTest.java  | 17 +++++++++++++++-
 .../maven/shared/filtering/StubMavenProject.java   |  3 ++-
 .../shared/filtering/TestReflectionProperties.java |  3 ++-
 src/test/units-files/propertyutils-test.properties | 23 ++++++++++++++++++++++
 5 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index 0fe15c4..b8d3fce 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 import java.io.File;
 import java.util.ArrayList;
diff --git a/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java b/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java
index 2a75b98..12bd282 100755
--- a/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 import java.io.File;
 import java.io.FileWriter;
@@ -98,4 +99,18 @@ public class PropertyUtilsTest
             // exception ok
         }
     }
+    
+    public void testloadpropertiesFile()
+        throws Exception
+    {
+        File propertyFile = new File( getBasedir() + "/src/test/units-files/propertyutils-test.properties" );
+        Properties baseProps = new Properties();
+        baseProps.put( "pom.version", "realVersion" );
+
+        Properties interpolated = PropertyUtils.loadPropertyFile( propertyFile, baseProps );
+        assertEquals( "realVersion", interpolated.get( "version" ) );
+        assertEquals( "${foo}", interpolated.get( "foo" ) );
+        assertEquals( "realVersion", interpolated.get( "bar" ) );
+        assertEquals( "none filtered", interpolated.get( "none" ) );
+    }    
 }
diff --git a/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java b/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java
index 2e3262c..9fb5cab 100755
--- a/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java
+++ b/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 import java.io.File;
 import java.util.Properties;
diff --git a/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
index e0a7077..4784f6e 100755
--- a/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
+++ b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 import java.io.File;
 import java.io.FileInputStream;
diff --git a/src/test/units-files/propertyutils-test.properties b/src/test/units-files/propertyutils-test.properties
new file mode 100755
index 0000000..aac8e87
--- /dev/null
+++ b/src/test/units-files/propertyutils-test.properties
@@ -0,0 +1,23 @@
+#/*
+# * 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.
+# */
+version=${pom.version}
+groupId=${pom.groupId}
+foo=${foo}
+none=none filtered
+bar=${version}
\ No newline at end of file


[maven-filtering] 30/44: add units on exclude/include

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 0758f94a7a3b325b6bf861ef0983ae8cfc009853
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Wed Feb 27 23:34:35 2008 +0000

    add units on exclude/include
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@631772 13f79535-47bb-0310-9956-ffa450edef68
---
 .../DefaultMavenResourcesFilteringTest.java        | 131 ++++++++++++++++++++-
 .../maven-resources-filtering/excludedir/bar.txt   |   1 +
 .../maven-resources-filtering/excludedir/foo.txt   |   1 +
 .../maven-resources-filtering/exludefile.txt       |   0
 .../includedir/include.txt                         |   0
 .../maven-resources-filtering/includefile.txt      |   0
 6 files changed, 131 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index fe5a6a1..b1f995f 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -139,7 +139,7 @@ public class DefaultMavenResourcesFilteringTest
     private void assertFiltering( File baseDir, File initialImageFile )
         throws Exception
     {
-        assertEquals( 3, outputDirectory.listFiles().length );
+        assertEquals( 7, outputDirectory.listFiles().length );
         Properties result = PropertyUtils.loadPropertyFile( new File( outputDirectory,
                                                                       "empty-maven-resources-filtering.txt" ), null );
         assertTrue( result.isEmpty() );
@@ -216,6 +216,7 @@ public class DefaultMavenResourcesFilteringTest
             .loadPropertyFile( new File( outputDirectory, "maven-resources-filtering.txt" ), null );
         assertFalse( result.isEmpty() );
         assertEquals( mavenProject.getName(), result.get( "pomName" ) );
+        assertFiltering( baseDir, initialImageFile );
     }
 
     public void testNoFiltering()
@@ -240,7 +241,7 @@ public class DefaultMavenResourcesFilteringTest
         mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, null,
                                                  Collections.EMPTY_LIST, new StubMavenSession() );
 
-        assertEquals( 3, outputDirectory.listFiles().length );
+        assertEquals( 7, outputDirectory.listFiles().length );
         Properties result = PropertyUtils.loadPropertyFile( new File( outputDirectory,
                                                                       "empty-maven-resources-filtering.txt" ), null );
         assertTrue( result.isEmpty() );
@@ -291,4 +292,130 @@ public class DefaultMavenResourcesFilteringTest
         return true;
     }
 
+    public void testIncludeOneFile()
+        throws Exception
+    {
+        File baseDir = new File( "c:\\foo\\bar" );
+        StubMavenProject mavenProject = new StubMavenProject( baseDir );
+        mavenProject.setVersion( "1.0" );
+        mavenProject.setGroupId( "org.apache" );
+        mavenProject.setName( "test project" );
+
+        MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
+            .getName() );
+
+        String unitFilesDir = getBasedir() + "/src/test/units-files/maven-resources-filtering";
+
+        Resource resource = new Resource();
+        List resources = new ArrayList();
+        resources.add( resource );
+        resource.setDirectory( unitFilesDir );
+        resource.setFiltering( true );
+        resource.addInclude( "includ*" );
+
+        List filtersFile = new ArrayList();
+        filtersFile.add( getBasedir()
+            + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
+
+        MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory,
+                                                                                       mavenProject, null, filtersFile,
+                                                                                       Collections.EMPTY_LIST,
+                                                                                       new StubMavenSession() );
+        mavenResourcesFiltering.filterResources( mavenResourcesExecution );
+        
+        File[] files = outputDirectory.listFiles();
+        assertEquals( 1, files.length );
+        assertEquals( "includefile.txt", files[0].getName() );
+        
+    }    
+    
+    public void testIncludeOneFileAndDirectory()
+        throws Exception
+    {
+        File baseDir = new File( "c:\\foo\\bar" );
+        StubMavenProject mavenProject = new StubMavenProject( baseDir );
+        mavenProject.setVersion( "1.0" );
+        mavenProject.setGroupId( "org.apache" );
+        mavenProject.setName( "test project" );
+
+        MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
+            .getName() );
+
+        String unitFilesDir = getBasedir() + "/src/test/units-files/maven-resources-filtering";
+
+        Resource resource = new Resource();
+        List resources = new ArrayList();
+        resources.add( resource );
+        resource.setDirectory( unitFilesDir );
+        resource.setFiltering( true );
+        resource.addInclude( "includ*" );
+        resource.addInclude( "**/includ*" );
+
+        List filtersFile = new ArrayList();
+        filtersFile.add( getBasedir()
+            + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
+
+        MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory,
+                                                                                       mavenProject, null, filtersFile,
+                                                                                       Collections.EMPTY_LIST,
+                                                                                       new StubMavenSession() );
+        mavenResourcesFiltering.filterResources( mavenResourcesExecution );
+
+        File[] files = outputDirectory.listFiles();
+        assertEquals( 2, files.length );
+        File includeFile = new File( outputDirectory, "includefile.txt" );
+        assertTrue( includeFile.exists() );
+
+        includeFile = new File( new File( outputDirectory, "includedir" ), "include.txt" );
+        assertTrue( includeFile.exists() );
+
+    }    
+    
+    public void testExcludeOneFile()
+        throws Exception
+    {
+        File baseDir = new File( "c:\\foo\\bar" );
+        StubMavenProject mavenProject = new StubMavenProject( baseDir );
+        mavenProject.setVersion( "1.0" );
+        mavenProject.setGroupId( "org.apache" );
+        mavenProject.setName( "test project" );
+
+        MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
+            .getName() );
+
+        String unitFilesDir = getBasedir() + "/src/test/units-files/maven-resources-filtering";
+
+        Resource resource = new Resource();
+        List resources = new ArrayList();
+        resources.add( resource );
+        resource.setDirectory( unitFilesDir );
+        resource.setFiltering( true );
+        resource.addExclude( "*.gif" );
+        resource.addExclude( "**/excludedir/**" );
+
+        List filtersFile = new ArrayList();
+        filtersFile.add( getBasedir()
+            + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
+
+        MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory,
+                                                                                       mavenProject, null, filtersFile,
+                                                                                       Collections.EMPTY_LIST,
+                                                                                       new StubMavenSession() );
+        mavenResourcesFiltering.filterResources( mavenResourcesExecution );
+
+        File[] files = outputDirectory.listFiles();
+        assertEquals( 5, files.length );
+        File includeFile = new File( outputDirectory, "includefile.txt" );
+        assertTrue( includeFile.exists() );
+
+        includeFile = new File( new File( outputDirectory, "includedir" ), "include.txt" );
+        assertTrue( includeFile.exists() );
+
+        File imageFile = new File( outputDirectory, "happy_duke.gif" );
+        assertFalse( imageFile.exists() );
+
+        File excludeDir = new File( outputDirectory, "excludedir" );
+        assertFalse( excludeDir.exists() );
+    }      
+    
 }
diff --git a/src/test/units-files/maven-resources-filtering/excludedir/bar.txt b/src/test/units-files/maven-resources-filtering/excludedir/bar.txt
new file mode 100755
index 0000000..32d5c9e
--- /dev/null
+++ b/src/test/units-files/maven-resources-filtering/excludedir/bar.txt
@@ -0,0 +1 @@
+excluded
\ No newline at end of file
diff --git a/src/test/units-files/maven-resources-filtering/excludedir/foo.txt b/src/test/units-files/maven-resources-filtering/excludedir/foo.txt
new file mode 100755
index 0000000..32d5c9e
--- /dev/null
+++ b/src/test/units-files/maven-resources-filtering/excludedir/foo.txt
@@ -0,0 +1 @@
+excluded
\ No newline at end of file
diff --git a/src/test/units-files/maven-resources-filtering/exludefile.txt b/src/test/units-files/maven-resources-filtering/exludefile.txt
new file mode 100755
index 0000000..e69de29
diff --git a/src/test/units-files/maven-resources-filtering/includedir/include.txt b/src/test/units-files/maven-resources-filtering/includedir/include.txt
new file mode 100755
index 0000000..e69de29
diff --git a/src/test/units-files/maven-resources-filtering/includefile.txt b/src/test/units-files/maven-resources-filtering/includefile.txt
new file mode 100755
index 0000000..e69de29


[maven-filtering] 34/44: o archiva and continuum are now TLP

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 835f17d68f37b7c669a0c801b20dd91738ba95b7
Author: Vincent Siveton <vs...@apache.org>
AuthorDate: Sat Apr 26 12:56:32 2008 +0000

    o archiva and continuum are now TLP
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@651829 13f79535-47bb-0310-9956-ffa450edef68
---
 src/site/site.xml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/site/site.xml b/src/site/site.xml
index 7033f1f..2880298 100755
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -46,7 +46,6 @@ under the License.
       <item name="Maven 1.x" href="http://maven.apache.org/maven-1.x"/>
       <item name="Maven 2.x" href="http://maven.apache.org/"/>
       <item name="Maven 2.x Plugins" href="http://maven.apache.org/plugins/"/>
-      <item name="Continuum" href="http://maven.apache.org/continuum"/>
       <item name="SCM" href="http://maven.apache.org/scm"/>
       <item name="Wagon" href="http://maven.apache.org/wagon"/>
       <item name="JXR" href="http://maven.apache.org/jxr"/>


[maven-filtering] 23/44: update documentation add missing file

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 7f8192a46af68fdd20cc3089bab4fd378c16e89d
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Feb 25 21:33:21 2008 +0000

    update documentation add missing file
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@631003 13f79535-47bb-0310-9956-ffa450edef68
---
 src/site/apt/index.apt                             |  6 +--
 .../maven/shared/filtering/StubMavenSession.java   | 43 ++++++++++++++++++++++
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
index cf8e617..0534011 100755
--- a/src/site/apt/index.apt
+++ b/src/site/apt/index.apt
@@ -42,9 +42,9 @@ Maven Filtering Component
   This component has a method which returns the default FileUtils.FilterWrapper.
   This are :
   
-    * interpolation with token $\{ \} and values from filters, project.filters, project.build.filters, pom.properties and SystemProps
+    * interpolation with token $\{ \} and values from filters, project.filters, project.build.filters, pom.properties and mavenSession.executionProperties
     
-    * interpolation with token @ @ and values from filters, project.filters, project.build.filters, pom.properties and SystemProps
+    * interpolation with token @ @ and values from filters, project.filters, project.build.filters, pom.properties and mavenSession.executionProperties
     
     * interpolation with token $\{ \} and values from mavenProject interpolation
     
@@ -67,4 +67,4 @@ Maven Filtering Component
     <<NOTE>> : As it's a Properties object, last defined key/value pair wins . 
     
     <<NOTE>> : When building the global Properties object and reading the properties files defined the different filters, 
-    interpolation with the token $\{ \} is supported for this filters with a limited properties values coming from pom.properties and System Properties (last wins too)
+    interpolation with the token $\{ \} is supported for this filters with a limited properties values coming from pom.properties and mavenSession.executionProperties (last wins too)
diff --git a/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java b/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java
new file mode 100755
index 0000000..ec7cd45
--- /dev/null
+++ b/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.util.Properties;
+
+import org.apache.maven.execution.MavenSession;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 24 f�vr. 2008
+ * @version $Id$
+ */
+public class StubMavenSession
+    extends MavenSession
+{
+    public StubMavenSession()
+    {
+        super( null, null, null, null, null, null, null, null, null );
+    }
+
+    public Properties getExecutionProperties()
+    {
+        return System.getProperties();
+    }
+    
+}


[maven-filtering] 24/44: fix documentation

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit c2833834ad3f5983794545c4b6e449a4ee50f591
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Feb 25 21:45:37 2008 +0000

    fix documentation
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@631010 13f79535-47bb-0310-9956-ffa450edef68
---
 src/site/apt/index.apt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
index 0534011..aa4fdf3 100755
--- a/src/site/apt/index.apt
+++ b/src/site/apt/index.apt
@@ -60,7 +60,7 @@ Maven Filtering Component
     
     * pom.properties
     
-    * System Properties
+    * mavenSession.executionProperties
     
     []
     


[maven-filtering] 36/44: remove unused imports and checkstyle error

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit acaf645eac10bf42992b859ce1986b08a33d96e8
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat May 10 13:53:31 2008 +0000

    remove unused imports and checkstyle error
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@655088 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/maven/shared/filtering/CompositeMap.java      | 1 -
 .../java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java | 2 +-
 src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java   | 3 +--
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java b/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
index c29a86c..337a7bc 100755
--- a/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
+++ b/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
@@ -19,7 +19,6 @@ package org.apache.maven.shared.filtering;
  * under the License.
  */
 
-import java.io.IOException;
 import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.Iterator;
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index eadefb0..6956468 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -166,7 +166,7 @@ public class DefaultMavenFileFilter
             for ( Iterator iterator = propertiesFilePaths.iterator(); iterator.hasNext(); )
             {
                 String filterFile = (String) iterator.next();
-                if (StringUtils.isEmpty( filterFile ))
+                if ( StringUtils.isEmpty( filterFile ) )
                 {
                     // skip empty file name
                     continue;
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index 72944d1..d9638c2 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -20,7 +20,6 @@ package org.apache.maven.shared.filtering;
  */
 
 import java.io.File;
-import java.io.IOException;
 import java.util.List;
 
 import org.apache.maven.execution.MavenSession;
@@ -43,7 +42,7 @@ public interface MavenFileFilter
      * @param filtering enable or not filering
      * @param mavenProject the mavenproject
      * @param filters {@link List} of String which are path to a Property file
-     * @throws IOException 
+     * @throws MavenFilteringException 
      */
     void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject, List filters,
                           boolean escapedBackslashesInFilePath, String encoding, MavenSession mavenSession )


[maven-filtering] 39/44: use released version

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 4c8b07c5aad5d5b9b4773fd406c3d611b2c28cd9
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Jul 26 01:34:46 2008 +0000

    use released version
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@679945 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index b2c3e54..793b3f3 100755
--- a/pom.xml
+++ b/pom.xml
@@ -79,7 +79,7 @@
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-interpolation</artifactId>
-      <version>1.2-SNAPSHOT</version>
+      <version>1.2</version>
     </dependency>
   </dependencies>
 


[maven-filtering] 43/44: remove inherited links lock site plugin version

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 0de28ba259a215921108a427e5083ee986dac48b
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Tue Jul 29 21:53:46 2008 +0000

    remove inherited links
    lock site plugin version
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@680855 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml           |  6 +++++-
 src/site/site.xml | 12 ------------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1229e9e..26d9eae 100755
--- a/pom.xml
+++ b/pom.xml
@@ -57,6 +57,10 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <artifactId>maven-site-plugin</artifactId>
+        <version>2.0-beta-7</version>
+      </plugin>
     </plugins>
   </build>
 	
@@ -82,5 +86,5 @@
       <version>1.2</version>
     </dependency>
   </dependencies>
-  
+ 
 </project>
diff --git a/src/site/site.xml b/src/site/site.xml
index 2880298..932b86a 100755
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -39,18 +39,6 @@ under the License.
       <item name="Reference" href="index.html"/>
       <item name="Usage" href="usage.html"/>
     </menu>
-    <!-- TODO: Link, head, reports should be inherited -->
-    <!-- TODO: use breadcrumbs more structure, links for links, and inherit subprojects as a menu or not at all -->
-    <links>
-      <item name="Apache" href="http://www.apache.org/"/>
-      <item name="Maven 1.x" href="http://maven.apache.org/maven-1.x"/>
-      <item name="Maven 2.x" href="http://maven.apache.org/"/>
-      <item name="Maven 2.x Plugins" href="http://maven.apache.org/plugins/"/>
-      <item name="SCM" href="http://maven.apache.org/scm"/>
-      <item name="Wagon" href="http://maven.apache.org/wagon"/>
-      <item name="JXR" href="http://maven.apache.org/jxr"/>
-      <item name="Doxia" href="http://maven.apache.org/doxia"/>
-    </links>
     <head>
       <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
       </script>


[maven-filtering] 15/44: add a parameter to pass a list of file extensions to not filtering

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 358ec19757b763643b0bc00a1acf9c65b8f4fa46
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Fri Feb 15 22:07:04 2008 +0000

    add a parameter to pass a list of file extensions to not filtering
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@628188 13f79535-47bb-0310-9956-ffa450edef68
---
 .../shared/filtering/DefaultMavenFileFilter.java   |   7 +-
 .../filtering/DefaultMavenResourcesFiltering.java  |  27 ++++++--
 .../shared/filtering/MavenResourcesFiltering.java  |   9 ++-
 .../DefaultMavenResourcesFilteringTest.java        |  74 +++++++++++++++++++--
 .../maven-resources-filtering/happy_duke.gif       | Bin 0 -> 36092 bytes
 5 files changed, 97 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index 1467c36..bf7709b 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -98,16 +98,15 @@ public class DefaultMavenFileFilter
         {
             for ( Iterator i = filters.iterator(); i.hasNext(); )
             {
-                String filtersfile = (String) i.next();
+                String filterfile = (String) i.next();
                 try
                 {
-
-                    Properties properties = PropertyUtils.loadPropertyFile( new File( filtersfile ), baseProps );
+                    Properties properties = PropertyUtils.loadPropertyFile( new File( filterfile ), baseProps );
                     filterProperties.putAll( properties );
                 }
                 catch ( IOException e )
                 {
-                    throw new MavenFilteringException( "Error loading property file '" + filtersfile + "'", e );
+                    throw new MavenFilteringException( "Error loading property file '" + filterfile + "'", e );
                 }
             }
         }
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index 1d6aecc..8db304f 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -27,6 +27,7 @@ import java.util.List;
 import org.apache.maven.model.Resource;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.FileUtils;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -51,15 +52,17 @@ public class DefaultMavenResourcesFiltering
     private MavenFileFilter mavenFileFilter;
     
     public void filterResources( List resources, File outputDirectory, MavenProject mavenProject, String encoding,
-                                 List fileFilters )
+                                 List fileFilters, List nonFilteredFileExtensions )
         throws MavenFilteringException
     {
         List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, fileFilters, true );
 
-        filterResources( resources, outputDirectory, encoding, filterWrappers, mavenProject.getBasedir() );
+        filterResources( resources, outputDirectory, encoding, filterWrappers, mavenProject.getBasedir(),
+                         nonFilteredFileExtensions );
     }
 
-    public void filterResources( List resources, File outputDirectory, String encoding, List filterWrappers, File resourcesBaseDirectory )
+    public void filterResources( List resources, File outputDirectory, String encoding, List filterWrappers,
+                                 File resourcesBaseDirectory, List nonFilteredFileExtensions )
         throws MavenFilteringException
     {
         for ( Iterator i = resources.iterator(); i.hasNext(); )
@@ -69,6 +72,7 @@ public class DefaultMavenResourcesFiltering
             String targetPath = resource.getTargetPath();
 
             File resourceDirectory = new File( resource.getDirectory() );
+
             if ( !resourceDirectory.isAbsolute() )
             {
                 resourceDirectory = new File( resourcesBaseDirectory, resourceDirectory.getPath() );
@@ -111,7 +115,7 @@ public class DefaultMavenResourcesFiltering
             scanner.scan();
 
             List includedFiles = Arrays.asList( scanner.getIncludedFiles() );
-            
+
             for ( Iterator j = includedFiles.iterator(); j.hasNext(); )
             {
                 String name = (String) j.next();
@@ -131,12 +135,23 @@ public class DefaultMavenResourcesFiltering
                 {
                     destinationFile.getParentFile().mkdirs();
                 }
-                mavenFileFilter.copyFile( source, destinationFile, resource.isFiltering(), filterWrappers, encoding );
+                boolean filteredExt = filteredFileExtension( source, nonFilteredFileExtensions );
+                mavenFileFilter.copyFile( source, destinationFile, resource.isFiltering() && filteredExt,
+                                          filterWrappers, encoding );
             }
         }
-        
+
     }
 
     
+    private boolean filteredFileExtension(File file, List nonFilteredFileExtensions)
+    {
+        if (nonFilteredFileExtensions == null)
+        {
+            return true;
+        }
+        return !nonFilteredFileExtensions.contains( FileUtils.extension( file.getName() ) );
+    }
+    
     
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
index 8ba557c..080c9ee 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -38,20 +38,23 @@ public interface MavenResourcesFiltering
      * @param mavenProject
      * @param encoding 
      * @param fileFilters {@link List} of String which are path to a Property file 
+     * @param nonFilteredFileExtensions {@link List} of String for non filtered file extensions
      * @throws MavenFilteringException
      */
     void filterResources( List resources, File outputDirectory, MavenProject mavenProject, String encoding,
-                                 List fileFilters )
+                          List fileFilters, List nonFilteredFileExtensions )
         throws MavenFilteringException;
 
-    
     /**
      * @param resources {@link List} of {@link org.apache.maven.model.Resource}
      * @param outputDirectory parent destination directory
      * @param encoding
      * @param filterWrappers {@link List} of FileUtils.FilterWrapper
+     * @param resourcesBaseDirectory baseDirectory of resources
+     * @param nonFilteredFileExtensions {@link List} of String for non filtered file extensions
      * @throws MavenFilteringException
      */
-    void filterResources( List resources, File outputDirectory, String encoding, List filterWrappers, File resourcesBaseDirectory )
+    void filterResources( List resources, File outputDirectory, String encoding, List filterWrappers,
+                          File resourcesBaseDirectory, List nonFilteredFileExtensions )
         throws MavenFilteringException;    
 }
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index b956042..73e396f 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -20,13 +20,17 @@ package org.apache.maven.shared.filtering;
  */
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
 import org.apache.maven.model.Resource;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -66,14 +70,22 @@ public class DefaultMavenResourcesFilteringTest
         MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
             .getName() );
 
+        String unitFilesDir = getBasedir() + "/src/test/units-files/maven-resources-filtering";
+        File initialImageFile = new File(unitFilesDir, "happy_duke.gif");
+        
         Resource resource = new Resource();
         List resources = new ArrayList();
         resources.add( resource );
-        resource.setDirectory( getBasedir() + "/src/test/units-files/maven-resources-filtering" );
+        resource.setDirectory( unitFilesDir );
         resource.setFiltering( true );
-        mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, null );
+
+        List filtersFile = new ArrayList();
+        filtersFile.add( getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
+        
+        List nonFilteredFileExtensions = Collections.singletonList( "gif" );
+        mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, filtersFile, nonFilteredFileExtensions );
        
-        assertEquals( 2, outputDirectory.listFiles().length );
+        assertEquals( 3, outputDirectory.listFiles().length );
         Properties result = PropertyUtils.loadPropertyFile( new File(outputDirectory, "empty-maven-resources-filtering.txt"), null );
         assertTrue (result.isEmpty());
         
@@ -90,6 +102,11 @@ public class DefaultMavenResourcesFilteringTest
         assertEquals( "@@", result.getProperty( "emptyexpression" ) );
         assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
         assertEquals( "zloug", result.getProperty( "javaVersion" ) );
+        
+        File imageFile = new File(outputDirectory, "happy_duke.gif");
+        assertTrue( imageFile.exists() );
+        //assertEquals( initialImageFile.length(), imageFile.length() );
+        assertTrue(filesAreIdentical( initialImageFile, imageFile ));
     }
     
     public void testNoFiltering()
@@ -102,14 +119,19 @@ public class DefaultMavenResourcesFilteringTest
         MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
             .getName() );
 
+        String unitFilesDir = getBasedir() + "/src/test/units-files/maven-resources-filtering";
+        File initialImageFile = new File(unitFilesDir, "happy_duke.gif");
+        
         Resource resource = new Resource();
         List resources = new ArrayList();
         resources.add( resource );
-        resource.setDirectory( getBasedir() + "/src/test/units-files/maven-resources-filtering" );
+        
+        resource.setDirectory( unitFilesDir );
         resource.setFiltering( false );
-        mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, null );
+        mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, null,
+                                                 Collections.EMPTY_LIST );
 
-        assertEquals( 2, outputDirectory.listFiles().length );
+        assertEquals( 3, outputDirectory.listFiles().length );
         Properties result = PropertyUtils.loadPropertyFile( new File( outputDirectory,
                                                                       "empty-maven-resources-filtering.txt" ), null );
         assertTrue( result.isEmpty() );
@@ -122,5 +144,43 @@ public class DefaultMavenResourcesFilteringTest
         assertEquals( "${foo}", result.get( "foo" ) );
         assertEquals( "@@", result.getProperty( "emptyexpression" ) );
         assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
-    }    
+        File imageFile = new File(outputDirectory, "happy_duke.gif");
+        assertTrue(filesAreIdentical( initialImageFile, imageFile ));
+    }  
+    
+    public static boolean filesAreIdentical( File expected, File current )
+        throws IOException
+    {
+        if ( expected.length() != current.length() )
+        {
+            return false;
+        }
+        FileInputStream expectedIn = new FileInputStream( expected );
+        FileInputStream currentIn = new FileInputStream( current );
+        try
+        {
+            byte[] expectedBuffer = IOUtil.toByteArray( expectedIn );
+            
+            byte[] currentBuffer = IOUtil.toByteArray( currentIn );
+            if (expectedBuffer.length != currentBuffer.length)
+            {
+                return false;
+            }
+            for (int i = 0,size = expectedBuffer.length;i<size;i++)
+            {
+                if(expectedBuffer[i]!= currentBuffer[i])
+                {
+                    return false;
+                }
+            }
+        }
+        finally
+        {
+            expectedIn.close();
+            currentIn.close();
+        }
+        return true;
+    }
+
+
 }
diff --git a/src/test/units-files/maven-resources-filtering/happy_duke.gif b/src/test/units-files/maven-resources-filtering/happy_duke.gif
new file mode 100755
index 0000000..9784ed6
Binary files /dev/null and b/src/test/units-files/maven-resources-filtering/happy_duke.gif differ


[maven-filtering] 38/44: use last plexus-utils version

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit e0ed77d497ac9ef28269ede56c62239eafe1aae3
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Jul 21 23:28:18 2008 +0000

    use last plexus-utils version
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@678598 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index e1180d0..b2c3e54 100755
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
-      <version>1.4.9</version>
+      <version>1.5.5</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>


[maven-filtering] 40/44: fix checstyle errors

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit a8cec412e87435713493847f7924826fe6dc22bb
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Jul 26 02:15:23 2008 +0000

    fix checstyle errors
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@679946 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/maven/shared/filtering/CompositeMap.java  |  2 +-
 .../maven/shared/filtering/DefaultMavenFileFilter.java   | 12 ++++++------
 .../shared/filtering/DefaultMavenResourcesFiltering.java | 16 +++++++++-------
 .../apache/maven/shared/filtering/FilteringUtils.java    | 14 +++++---------
 .../apache/maven/shared/filtering/MavenFileFilter.java   |  6 +++---
 .../maven/shared/filtering/MavenResourcesExecution.java  |  4 ++--
 .../filtering/PropertiesEscapingBackSlahValueSource.java |  6 +++---
 7 files changed, 29 insertions(+), 31 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java b/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
index 6be53de..157cace 100755
--- a/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
+++ b/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
@@ -54,7 +54,7 @@ public class CompositeMap
     /**
      * @param maps an orderer {@link List} of {@link Map}
      * @param useSystemProperties using or not the System Properties
-     * @param systemPropertiesFirst if with get( key ) the systemProperties must wins (the internal ordered {@link List} 
+     * @param systemPropertiesFirst if with get( key ) the sysProps must wins (the internal ordered {@link List} 
      *        will have in first the System Properties)
      */
     public CompositeMap( List /*Map*/maps, boolean useSystemProperties, boolean systemPropertiesFirst )
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index cc5e4db..17bf524 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -53,7 +53,8 @@ public class DefaultMavenFileFilter
                           boolean escapedBackslashesInFilePath, String encoding, MavenSession mavenSession )
         throws MavenFilteringException
     {
-        List filterWrappers = getDefaultFilterWrappers( mavenProject, filters, escapedBackslashesInFilePath, mavenSession );
+        List filterWrappers = getDefaultFilterWrappers( mavenProject, filters, escapedBackslashesInFilePath,
+                                                        mavenSession );
         copyFile( from, to, filtering, filterWrappers, encoding );
     }
 
@@ -126,9 +127,8 @@ public class DefaultMavenFileFilter
         
         List defaultFilterWrappers = new ArrayList( 3 );
 
-        final ValueSource propertiesValueSource = new PropertiesEscapingBackSlahValueSource(
-                                                                                             escapedBackslashesInFilePath,
-                                                                                             filterProperties );
+        final ValueSource propertiesValueSource = 
+            new PropertiesEscapingBackSlahValueSource( escapedBackslashesInFilePath, filterProperties );
         
         // support ${token}
 
@@ -148,7 +148,7 @@ public class DefaultMavenFileFilter
         {
             public Reader getReader( Reader reader )
             {
-                final Interpolator propertiesInterpolatorAtRegex = new RegexBasedInterpolator("\\@", "(.+?)\\@");
+                final Interpolator propertiesInterpolatorAtRegex = new RegexBasedInterpolator( "\\@", "(.+?)\\@" );
                 propertiesInterpolatorAtRegex.addValueSource( propertiesValueSource );                
                 return new InterpolatorFilterReader( reader, propertiesInterpolatorAtRegex, "@", "@" );
             }
@@ -174,7 +174,7 @@ public class DefaultMavenFileFilter
         {
             public Reader getReader( Reader reader )
             {
-                Interpolator mavenProjectInterpolator = new RegexBasedInterpolator("\\@", "(.+?)\\@");
+                Interpolator mavenProjectInterpolator = new RegexBasedInterpolator( "\\@", "(.+?)\\@" );
                  
                 ValueSource valueSource = new MavenProjectValueSource( mavenProject, escapedBackslashesInFilePath );
                 mavenProjectInterpolator.addValueSource( valueSource );
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index 54a468b..3ec1bae 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -153,11 +153,15 @@ public class DefaultMavenResourcesFiltering
 
         if ( mavenResourcesExecution.getEncoding() == null || mavenResourcesExecution.getEncoding().length() < 1 )
         {
-            getLogger().info( "Using platform encoding (" + ReaderFactory.FILE_ENCODING + " actually) to copy filtered resources." );
+            getLogger().info(
+                              "Using platform encoding (" + ReaderFactory.FILE_ENCODING
+                                  + " actually) to copy filtered resources." );
         }
         else
         {
-            getLogger().info( "Using '" + mavenResourcesExecution.getEncoding() + "' encoding to copy filtered resources." );
+            getLogger().info(
+                              "Using '" + mavenResourcesExecution.getEncoding()
+                                  + "' encoding to copy filtered resources." );
         }
         
         for ( Iterator i = mavenResourcesExecution.getResources().iterator(); i.hasNext(); )
@@ -183,12 +187,10 @@ public class DefaultMavenResourcesFiltering
             // this part is required in case the user specified "../something" as destination
             // see MNG-1345
             File outputDirectory = mavenResourcesExecution.getOutputDirectory();
-            if ( !outputDirectory.exists() )
+            if ( !outputDirectory.exists() && !outputDirectory.mkdirs() )
             {
-                if ( !outputDirectory.mkdirs() )
-                {
-                    throw new MavenFilteringException( "Cannot create resource output directory: " + outputDirectory );
-                }
+                throw new MavenFilteringException( "Cannot create resource output directory: " + outputDirectory );
+
             }
 
             DirectoryScanner scanner = new DirectoryScanner();
diff --git a/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java b/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java
index f28fc87..990d9ee 100755
--- a/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java
+++ b/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java
@@ -1,7 +1,5 @@
 package org.apache.maven.shared.filtering;
 
-import org.codehaus.plexus.util.StringUtils;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,6 +19,8 @@ import org.codehaus.plexus.util.StringUtils;
  * under the License.
  */
 
+import org.codehaus.plexus.util.StringUtils;
+
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
  * @since 21 juil. 2008
@@ -39,14 +39,10 @@ public class FilteringUtils
     
     public static final String escapeWindowsPath( String val )
     {
-        if ( !StringUtils.isEmpty( val ) )
+        if ( !StringUtils.isEmpty( val ) && val.indexOf( ":\\" ) == 1 )
         {
-            // Check if it's a windows path
-            if ( val.indexOf( ":\\" ) == 1 )
-            {
-                val = StringUtils.replace( (String) val, "\\", "\\\\" );
-                val = StringUtils.replace( (String) val, ":", "\\:" );
-            }
+            val = StringUtils.replace( (String) val, "\\", "\\\\" );
+            val = StringUtils.replace( (String) val, ":", "\\:" );
         }
         return val;
     }
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index 1620159..d1bc248 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -63,9 +63,9 @@ public interface MavenFileFilter
      * Will return the default FileUtils.FilterWrappers
      * 
      * <ul>
-     *   <li>interpolation with token ${ } and values from SystemProps, project.properties, from filters and project filters.</li>
-     *   <li>interpolation with token @ @ and values from SystemProps, project.properties, from filters and project filters.</li>
-     *   <li>interpolation with token ${ } and values from mavenProject interpolation.</li>
+     *   <li>interpolate with token ${} and values from sysProps, project.properties, filters and project filters.</li>
+     *   <li>interpolate with token @ @ and values from sysProps, project.properties, filters and project filters.</li>
+     *   <li>interpolate with token ${} and values from mavenProject interpolation.</li>
      * </ul>
      * 
      * @param mavenProject
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java
index 2e5e63d..441959f 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 import java.io.File;
 import java.io.Reader;
@@ -24,7 +25,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.model.Resource;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.interpolation.Interpolator;
 import org.codehaus.plexus.interpolation.InterpolatorFilterReader;
diff --git a/src/main/java/org/apache/maven/shared/filtering/PropertiesEscapingBackSlahValueSource.java b/src/main/java/org/apache/maven/shared/filtering/PropertiesEscapingBackSlahValueSource.java
index bc98355..76b6afb 100755
--- a/src/main/java/org/apache/maven/shared/filtering/PropertiesEscapingBackSlahValueSource.java
+++ b/src/main/java/org/apache/maven/shared/filtering/PropertiesEscapingBackSlahValueSource.java
@@ -33,13 +33,13 @@ public class PropertiesEscapingBackSlahValueSource
 {
 
     private boolean escapedBackslashesInFilePath;
-    
+
     private Properties properties;
-    
+
     /**
      * 
      */
-    public PropertiesEscapingBackSlahValueSource(boolean escapedBackslashesInFilePath, Properties properties)
+    public PropertiesEscapingBackSlahValueSource( boolean escapedBackslashesInFilePath, Properties properties )
     {
         this.escapedBackslashesInFilePath = escapedBackslashesInFilePath;
         this.properties = properties == null ? new Properties() : properties;


[maven-filtering] 05/44: add project filter files in the value interpolation Map add a hack for interpolation on file for windows

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 559b83be720b9b0bed6f404f94890ce1aa06cbe6
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Thu Jan 31 23:48:31 2008 +0000

    add project filter files in the value interpolation Map
    add a hack for interpolation on file for windows
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@617299 13f79535-47bb-0310-9956-ffa450edef68
---
 .../shared/filtering/DefaultMavenFileFilter.java   | 42 +++++++++++++++++++++-
 .../maven/shared/filtering/MavenFileFilter.java    |  4 +--
 .../shared/filtering/ReflectionProperties.java     | 24 ++++++++++---
 .../DefaultMavenResourcesFilteringTest.java        | 10 +++---
 .../maven/shared/filtering/StubMavenProject.java   | 13 +++++++
 .../maven-resources-filtering.txt                  |  3 +-
 6 files changed, 83 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index fe58371..0437f11 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -42,7 +42,7 @@ import org.codehaus.plexus.util.InterpolationFilterReader;
 public class DefaultMavenFileFilter
     implements MavenFileFilter
 {
-
+    
     /** 
      * @see org.apache.maven.shared.filtering.MavenFileFilter#copyFile(java.io.File, java.io.File, boolean, org.apache.maven.project.MavenProject, java.util.List)
      */
@@ -119,7 +119,46 @@ public class DefaultMavenFileFilter
                 }
             }
         }
+        
+        List buildFilters = mavenProject.getFilters();
+        if (buildFilters != null)
+        {
+            for (Iterator iterator = buildFilters.iterator();iterator.hasNext();)
+            {
+                String filterFile = (String) iterator.next();
+                try
+                {
+
+                    Properties properties = PropertyUtils.loadPropertyFile( new File( filterFile ), baseProps );
+                    filterProperties.putAll( properties );
+                }
+                catch ( IOException e )
+                {
+                    throw new MavenFilteringException( "Error loading property file '" + filterFile + "'", e );
+                }
+            }
+        }        
+        
+        buildFilters = mavenProject.getBuild().getFilters();
+        if (buildFilters != null)
+        {
+            for (Iterator iterator = buildFilters.iterator();iterator.hasNext();)
+            {
+                String filterFile = (String) iterator.next();
+                try
+                {
+
+                    Properties properties = PropertyUtils.loadPropertyFile( new File( filterFile ), baseProps );
+                    filterProperties.putAll( properties );
+                }
+                catch ( IOException e )
+                {
+                    throw new MavenFilteringException( "Error loading property file '" + filterFile + "'", e );
+                }
+            }
+        }
 
+       
         List defaultFilterWrappers = new ArrayList( 3 );
 
         // support ${token}
@@ -151,6 +190,7 @@ public class DefaultMavenFileFilter
                 return new InterpolationFilterReader( reader, reflectionProperties, "${", "}" );
             }
         };
+        
         defaultFilterWrappers.add( third );
 
         return defaultFilterWrappers;
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index a0c29ac..ea8a452 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -62,8 +62,8 @@ public interface MavenFileFilter
      * Will return the default FileUtils.FilterWrappers
      * 
      * <ul>
-     *   <li>interpolation with token ${ } and values from System.getProperties, project.getProperties and from filters.</li>
-     *   <li>interpolation with token @ @ and values from System.getProperties, project.getProperties and from filters.</li>
+     *   <li>interpolation with token ${ } and values from System.getProperties, project.getProperties, from filters and project filters.</li>
+     *   <li>interpolation with token @ @ and values from System.getProperties, project.getProperties, from filters and project filters.</li>
      *   <li>interpolation with token ${ } and values from mavenProject interpolation.</li>
      * </ul>
      * 
diff --git a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
index a6d9ef9..f398658 100755
--- a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
+++ b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
@@ -19,6 +19,7 @@ package org.apache.maven.shared.filtering;
  * under the License.
  */
 
+import java.io.File;
 import java.util.AbstractMap;
 import java.util.Set;
 
@@ -58,24 +59,37 @@ public class ReflectionProperties
         Object value = null;
         try 
         {
-            value = ReflectionValueExtractor.evaluate( "" + key , project );
+            value = ReflectionValueExtractor.evaluate( "" + key, project );
 
-            if ( escapedBackslashesInFilePath && value != null &&
-                "java.lang.String".equals( value.getClass().getName() ) )
+            if ( escapedBackslashesInFilePath && value != null
+                && "java.lang.String".equals( value.getClass().getName() ) )
             {
                 String val = (String) value;
 
                 // Check if it's a windows path
                 if ( val.indexOf( ":\\" ) == 1 )
                 {
-                    value = StringUtils.replace( (String)value, "\\", "\\\\" );
-                    value = StringUtils.replace( (String)value, ":", "\\:" );
+                    value = StringUtils.replace( (String) value, "\\", "\\\\" );
+                    value = StringUtils.replace( (String) value, ":", "\\:" );
                 }
             }
+            else if ( escapedBackslashesInFilePath && value != null
+                && File.class.getName().equals( value.getClass().getName() ) )
+            {
+                String val = ( (File) value ).getPath();
+                // Check if it's a windows path
+                if ( val.indexOf( ":\\" ) == 1 )
+                {
+                    value = StringUtils.replace( (String) val, "\\", "\\\\" );
+                    value = StringUtils.replace( (String) value, ":", "\\:" );
+                }
+            }
+            
         }
         catch ( Exception e ) 
         {
             //TODO: remove the try-catch block when ReflectionValueExtractor.evaluate() throws no more exceptions
+            e.printStackTrace();
         } 
         return value;
     }
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index aacc834..10741e9 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Properties;
 
 import org.apache.maven.model.Resource;
-import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -55,12 +54,12 @@ public class DefaultMavenResourcesFilteringTest
     public void testSimpleFiltering()
         throws Exception
     {
-        StubMavenProject mavenProject = new StubMavenProject();
+        StubMavenProject mavenProject = new StubMavenProject( new File( getBasedir() ) );
         mavenProject.setVersion( "1.0" );
         mavenProject.setGroupId( "org.apache" );
 
         Properties projectProperties = new Properties();
-        projectProperties.put( "foo", "bar" );        
+        projectProperties.put( "foo", "bar" );     
         mavenProject.setProperties( projectProperties );
         MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
             .getName() );
@@ -82,12 +81,15 @@ public class DefaultMavenResourcesFilteringTest
         assertEquals("1.0", result.get( "version" ));
         assertEquals("org.apache", result.get( "groupId" ));
         assertEquals("bar", result.get( "foo" ));
+        // FIXME this can fail with a windows path
+        String base = result.getProperty( "base" );
+        assertEquals(getBasedir(), base);
     }
     
     public void testNoFiltering()
         throws Exception
     {
-        StubMavenProject mavenProject = new StubMavenProject();
+        StubMavenProject mavenProject = new StubMavenProject( new File( getBasedir() ) );
         mavenProject.setVersion( "1.0" );
         mavenProject.setGroupId( "org.apache" );
 
diff --git a/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java b/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java
index b7ce5ab..2e3262c 100755
--- a/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java
+++ b/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java
@@ -18,6 +18,7 @@
  */
 package org.apache.maven.shared.filtering;
 
+import java.io.File;
 import java.util.Properties;
 
 import org.apache.maven.project.MavenProject;
@@ -31,7 +32,14 @@ public class StubMavenProject
     extends MavenProject
 {
     private Properties properties;
+    
+    private File basedir;
 
+    protected StubMavenProject (File basedir)
+    {
+        this.basedir = basedir;
+    }
+    
     public Properties getProperties()
     {
         return this.properties;
@@ -42,5 +50,10 @@ public class StubMavenProject
         this.properties = properties;
     }
 
+    public File getBasedir()
+    {
+        return basedir;
+    }
+
 
 }
diff --git a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
index 022a0a0..d5b56d1 100755
--- a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
+++ b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
@@ -19,4 +19,5 @@
 version=${pom.version}
 groupId=${pom.groupId}
 foo=${foo}
-none=none filtered
\ No newline at end of file
+none=none filtered
+base=${pom.basedir}
\ No newline at end of file


[maven-filtering] 16/44: add a predefined list (jpg, jpeg, gif, bmp, png) of known extensions which doesn't support filtering force the extension in lowerCase when testing if the file need filtering

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 93a7ba9a42dfa154120b9622864e28de05823406
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sun Feb 17 13:57:28 2008 +0000

    add a predefined list (jpg,jpeg,gif,bmp,png) of known extensions which doesn't support filtering
    force the extension in lowerCase when testing if the file need filtering
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@628487 13f79535-47bb-0310-9956-ffa450edef68
---
 .../filtering/DefaultMavenResourcesFiltering.java  | 39 +++++++++++++++++++---
 .../shared/filtering/MavenResourcesFiltering.java  |  6 ++++
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index 8db304f..f9122c5 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -20,14 +20,18 @@ package org.apache.maven.shared.filtering;
  */
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
 import org.apache.maven.model.Resource;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -38,13 +42,32 @@ import org.codehaus.plexus.util.FileUtils;
  *                   role-hint="default"
  */
 public class DefaultMavenResourcesFiltering
-    implements MavenResourcesFiltering
+    implements MavenResourcesFiltering, Initializable
 {
 
     private static final String[] EMPTY_STRING_ARRAY = {};
 
     private static final String[] DEFAULT_INCLUDES = {"**/**"};
     
+    private List defaultNonFilteredFileExtensions;
+    
+    // ------------------------------------------------
+    //  Plexus lifecycle
+    // ------------------------------------------------
+    public void initialize()
+        throws InitializationException
+    {
+        // jpg,jpeg,gif,bmp,png
+        this.defaultNonFilteredFileExtensions = new ArrayList( 5 );
+        this.defaultNonFilteredFileExtensions.add( "jpg" );
+        this.defaultNonFilteredFileExtensions.add( "jpeg" );
+        this.defaultNonFilteredFileExtensions.add( "gif" );
+        this.defaultNonFilteredFileExtensions.add( "bmp" );
+        this.defaultNonFilteredFileExtensions.add( "png" );
+    }    
+    
+    
+    
     /**
      * @plexus.requirement
      *  role-hint="default"
@@ -144,13 +167,19 @@ public class DefaultMavenResourcesFiltering
     }
 
     
-    private boolean filteredFileExtension(File file, List nonFilteredFileExtensions)
+    private boolean filteredFileExtension( File file, List userNonFilteredFileExtensions )
     {
-        if (nonFilteredFileExtensions == null)
+        List nonFilteredFileExtensions = new ArrayList( getDefaultNonFilteredFileExtensions() );
+        if ( userNonFilteredFileExtensions != null )
         {
-            return true;
+            nonFilteredFileExtensions.addAll( userNonFilteredFileExtensions );
         }
-        return !nonFilteredFileExtensions.contains( FileUtils.extension( file.getName() ) );
+        return !nonFilteredFileExtensions.contains( StringUtils.lowerCase( FileUtils.extension( file.getName() ) ) );
+    }
+
+    public List getDefaultNonFilteredFileExtensions()
+    {
+        return this.defaultNonFilteredFileExtensions;
     }
     
     
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
index 080c9ee..be0b638 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -57,4 +57,10 @@ public interface MavenResourcesFiltering
     void filterResources( List resources, File outputDirectory, String encoding, List filterWrappers,
                           File resourcesBaseDirectory, List nonFilteredFileExtensions )
         throws MavenFilteringException;    
+    
+    /**
+     * return the List of the non filtered extensions (jpg,jpeg,gif,bmp,png)
+     * @return {@link List} of {@link String}
+     */
+    public List getDefaultNonFilteredFileExtensions();
 }


[maven-filtering] 02/44: remove eclipse files

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit cdb27153a584ed911829d0e98884fc8a3901a552
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Thu Jan 24 00:29:44 2008 +0000

    remove eclipse files
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@614752 13f79535-47bb-0310-9956-ffa450edef68
---
 .classpath                           | 21 ---------------------
 .project                             | 13 -------------
 .settings/org.eclipse.jdt.core.prefs |  5 -----
 3 files changed, 39 deletions(-)

diff --git a/.classpath b/.classpath
deleted file mode 100755
index c10b3b7..0000000
--- a/.classpath
+++ /dev/null
@@ -1,21 +0,0 @@
-<classpath>
-  <classpathentry kind="src" path="src/main/java"/>
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
-  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
-  <classpathentry kind="src" path="target/maven-shared-archive-resources" excluding="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-utils/1.4.9/plexus-utils-1.4.9.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.jar"/>
-</classpath>
\ No newline at end of file
diff --git a/.project b/.project
deleted file mode 100755
index 26aa53c..0000000
--- a/.project
+++ /dev/null
@@ -1,13 +0,0 @@
-<projectDescription>
-  <name>maven-filtering</name>
-  <comment>Maven shared components</comment>
-  <projects/>
-  <buildSpec>
-    <buildCommand>
-      <name>org.eclipse.jdt.core.javabuilder</name>
-    </buildCommand>
-  </buildSpec>
-  <natures>
-    <nature>org.eclipse.jdt.core.javanature</nature>
-  </natures>
-</projectDescription>
\ No newline at end of file
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100755
index 4f8e077..0000000
--- a/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Sun Jan 20 22:27:40 CET 2008
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.source=1.4
-org.eclipse.jdt.core.compiler.compliance=1.4


[maven-filtering] 37/44: use plexus-interpolation in the maven-filtering component

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 47ed5a14ed0ec7de0cfae1d399009bdf689d819e
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Jul 21 23:25:27 2008 +0000

    use plexus-interpolation in the maven-filtering component
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@678595 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 20 +++++++
 .../maven/shared/filtering/CompositeMap.java       |  2 +-
 .../shared/filtering/DefaultMavenFileFilter.java   | 43 +++++++++++---
 .../maven/shared/filtering/FilteringUtils.java     | 54 +++++++++++++++++
 .../maven/shared/filtering/MavenFileFilter.java    |  3 +-
 ...roperties.java => MavenProjectValueSource.java} | 39 ++++--------
 .../shared/filtering/MavenResourcesExecution.java  | 69 ++++++++++++++++++++++
 .../PropertiesEscapingBackSlahValueSource.java     | 57 ++++++++++++++++++
 src/site/apt/index.apt                             |  2 +
 src/site/apt/usage.apt                             | 21 ++++---
 .../DefaultMavenResourcesFilteringTest.java        | 28 +++------
 .../shared/filtering/TestReflectionProperties.java |  4 --
 .../maven-resources-filtering.txt                  |  1 +
 13 files changed, 277 insertions(+), 66 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0490ed7..e1180d0 100755
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,26 @@
       <artifactId>plexus-utils</artifactId>
       <version>1.4.9</version>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-interpolation</artifactId>
+      <version>1.2-SNAPSHOT</version>
+    </dependency>
   </dependencies>
 
+  <!-- remove when plexus-interpolation 1.2 is released -->
+  <repositories>
+    <repository>
+      <id>snapshots.codehaus.org</id>
+      <name>Codehaus Snapshot Development Repository</name>
+      <url>http://snapshots.repository.codehaus.org/</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+  
 </project>
diff --git a/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java b/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
index 337a7bc..6be53de 100755
--- a/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
+++ b/src/main/java/org/apache/maven/shared/filtering/CompositeMap.java
@@ -42,7 +42,7 @@ public class CompositeMap
     private boolean systemPropertiesFirst;
 
     /**
-     * Ca
+     * 
      * @param maps
      * @throws IOException if getting envvars failed
      */
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index 6956468..cc5e4db 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -30,8 +30,11 @@ import java.util.Properties;
 
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.interpolation.Interpolator;
+import org.codehaus.plexus.interpolation.InterpolatorFilterReader;
+import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
+import org.codehaus.plexus.interpolation.ValueSource;
 import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.InterpolationFilterReader;
 import org.codehaus.plexus.util.StringUtils;
 
 /**
@@ -123,12 +126,19 @@ public class DefaultMavenFileFilter
         
         List defaultFilterWrappers = new ArrayList( 3 );
 
+        final ValueSource propertiesValueSource = new PropertiesEscapingBackSlahValueSource(
+                                                                                             escapedBackslashesInFilePath,
+                                                                                             filterProperties );
+        
         // support ${token}
+
         FileUtils.FilterWrapper one = new FileUtils.FilterWrapper()
         {
             public Reader getReader( Reader reader )
             {
-                return new InterpolationFilterReader( reader, filterProperties, "${", "}" );
+                Interpolator propertiesInterpolator = new RegexBasedInterpolator();
+                propertiesInterpolator.addValueSource( propertiesValueSource  );                
+                return new InterpolatorFilterReader( reader, propertiesInterpolator );
             }
         };
         defaultFilterWrappers.add( one );
@@ -138,22 +148,41 @@ public class DefaultMavenFileFilter
         {
             public Reader getReader( Reader reader )
             {
-                return new InterpolationFilterReader( reader, filterProperties, "@", "@" );
+                final Interpolator propertiesInterpolatorAtRegex = new RegexBasedInterpolator("\\@", "(.+?)\\@");
+                propertiesInterpolatorAtRegex.addValueSource( propertiesValueSource );                
+                return new InterpolatorFilterReader( reader, propertiesInterpolatorAtRegex, "@", "@" );
             }
         };
         defaultFilterWrappers.add( second );
+        
         // support ${token} with mavenProject reflection
         FileUtils.FilterWrapper third = new FileUtils.FilterWrapper()
         {
             public Reader getReader( Reader reader )
             {
-                ReflectionProperties reflectionProperties = new ReflectionProperties( mavenProject,
-                                                                                      escapedBackslashesInFilePath );
-                return new InterpolationFilterReader( reader, reflectionProperties, "${", "}" );
+                Interpolator mavenProjectInterpolator = new RegexBasedInterpolator();
+                 
+                ValueSource valueSource = new MavenProjectValueSource( mavenProject, escapedBackslashesInFilePath );
+                mavenProjectInterpolator.addValueSource( valueSource );
+                return new InterpolatorFilterReader( reader, mavenProjectInterpolator );
             }
         };
-
         defaultFilterWrappers.add( third );
+        
+        // support @token@ with mavenProject reflection
+        FileUtils.FilterWrapper fourth = new FileUtils.FilterWrapper()
+        {
+            public Reader getReader( Reader reader )
+            {
+                Interpolator mavenProjectInterpolator = new RegexBasedInterpolator("\\@", "(.+?)\\@");
+                 
+                ValueSource valueSource = new MavenProjectValueSource( mavenProject, escapedBackslashesInFilePath );
+                mavenProjectInterpolator.addValueSource( valueSource );
+                return new InterpolatorFilterReader( reader, mavenProjectInterpolator, "@", "@" );
+            }
+        };        
+
+        defaultFilterWrappers.add( fourth );
 
         return defaultFilterWrappers;
     }
diff --git a/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java b/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java
new file mode 100755
index 0000000..f28fc87
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java
@@ -0,0 +1,54 @@
+package org.apache.maven.shared.filtering;
+
+import org.codehaus.plexus.util.StringUtils;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 21 juil. 2008
+ * @version $Id$
+ */
+public class FilteringUtils
+{
+
+    /**
+     * 
+     */
+    private FilteringUtils()
+    {
+        // nothing just an util class
+    }
+    
+    public static final String escapeWindowsPath( String val )
+    {
+        if ( !StringUtils.isEmpty( val ) )
+        {
+            // Check if it's a windows path
+            if ( val.indexOf( ":\\" ) == 1 )
+            {
+                val = StringUtils.replace( (String) val, "\\", "\\\\" );
+                val = StringUtils.replace( (String) val, ":", "\\:" );
+            }
+        }
+        return val;
+    }
+
+}
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index d9638c2..1620159 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -74,6 +74,7 @@ public interface MavenFileFilter
      * @return {@link List} of FileUtils.FilterWrapper 
      * 
      */
-    List getDefaultFilterWrappers( MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath, MavenSession mavenSession )
+    List getDefaultFilterWrappers( MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath,
+                                   MavenSession mavenSession )
         throws MavenFilteringException;
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java b/src/main/java/org/apache/maven/shared/filtering/MavenProjectValueSource.java
similarity index 64%
rename from src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
rename to src/main/java/org/apache/maven/shared/filtering/MavenProjectValueSource.java
index dd35a46..1fde88a 100755
--- a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenProjectValueSource.java
@@ -20,32 +20,32 @@ package org.apache.maven.shared.filtering;
  */
 
 import java.io.File;
-import java.util.AbstractMap;
-import java.util.Set;
 
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.interpolation.ValueSource;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
 
 
 /**
  * @author Andreas Hoheneder (ahoh_at_inode.at)
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
  * @version $Id$
  */
-public class ReflectionProperties
-    extends AbstractMap
+public class MavenProjectValueSource
+    implements ValueSource
 {
 
     private MavenProject project;
 
     private boolean escapedBackslashesInFilePath;
 
-    public ReflectionProperties( MavenProject mavenProject  ) 
+    public MavenProjectValueSource( MavenProject mavenProject  ) 
     {
        this( mavenProject, false );
     }    
     
-    public ReflectionProperties( MavenProject mavenProject, boolean escapedBackslashesInFilePath ) 
+    public MavenProjectValueSource( MavenProject mavenProject, boolean escapedBackslashesInFilePath ) 
     {
        super();
 
@@ -54,9 +54,10 @@ public class ReflectionProperties
        this.escapedBackslashesInFilePath = escapedBackslashesInFilePath;
     }
     
-    public Object get( Object key )
+
+    public Object getValue( String expression )
     {
-        if ( key == null || StringUtils.isEmpty( key.toString() ) )
+        if ( expression == null || StringUtils.isEmpty( expression.toString() ) )
         {
             return null;
         }
@@ -64,30 +65,19 @@ public class ReflectionProperties
         Object value = null;
         try 
         {
-            value = ReflectionValueExtractor.evaluate( "" + key, project );
+            value = ReflectionValueExtractor.evaluate( "" + expression, project );
 
             if ( escapedBackslashesInFilePath && value != null
                 && "java.lang.String".equals( value.getClass().getName() ) )
             {
                 String val = (String) value;
-
-                // Check if it's a windows path
-                if ( val.indexOf( ":\\" ) == 1 )
-                {
-                    value = StringUtils.replace( (String) value, "\\", "\\\\" );
-                    value = StringUtils.replace( (String) value, ":", "\\:" );
-                }
+                value = FilteringUtils.escapeWindowsPath( val );
             }
             else if ( escapedBackslashesInFilePath && value != null
                 && File.class.getName().equals( value.getClass().getName() ) )
             {
                 String val = ( (File) value ).getPath();
-                // Check if it's a windows path
-                if ( val.indexOf( ":\\" ) == 1 )
-                {
-                    value = StringUtils.replace( (String) val, "\\", "\\\\" );
-                    value = StringUtils.replace( (String) value, ":", "\\:" );
-                }
+                value = FilteringUtils.escapeWindowsPath( val );
             }
             
         }
@@ -96,10 +86,5 @@ public class ReflectionProperties
             //TODO: remove the try-catch block when ReflectionValueExtractor.evaluate() throws no more exceptions
         } 
         return value;
-    }
-    
-    public Set entrySet()
-    {
-        throw new UnsupportedOperationException( "Cannot enumerate properties in a project" );
     }    
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java
index 330fe6f..2e5e63d 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java
@@ -19,11 +19,18 @@
 package org.apache.maven.shared.filtering;
 
 import java.io.File;
+import java.io.Reader;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Resource;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.interpolation.Interpolator;
+import org.codehaus.plexus.interpolation.InterpolatorFilterReader;
+import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
+import org.codehaus.plexus.interpolation.ValueSource;
+import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.FileUtils.FilterWrapper;
 
 /**
@@ -35,6 +42,7 @@ import org.codehaus.plexus.util.FileUtils.FilterWrapper;
 public class MavenResourcesExecution
 {
 
+    /** @see Resource  */
     private List resources;
 
     private File outputDirectory;
@@ -97,11 +105,18 @@ public class MavenResourcesExecution
         this.useDefaultFilterWrappers = false;
     }
 
+    
+    /**
+     * @return List of {@link Resource}
+     */
     public List getResources()
     {
         return resources;
     }
 
+    /**
+     * @param resources List of {@link Resource}
+     */
     public void setResources( List resources )
     {
         this.resources = resources;
@@ -117,6 +132,9 @@ public class MavenResourcesExecution
         this.outputDirectory = outputDirectory;
     }
 
+    /**
+     * @return can be null
+     */
     public MavenProject getMavenProject()
     {
         return mavenProject;
@@ -137,21 +155,33 @@ public class MavenResourcesExecution
         this.encoding = encoding;
     }
 
+    /**
+     * @return List of {@link String} which are properties file
+     */
     public List getFileFilters()
     {
         return fileFilters;
     }
 
+    /**
+     * @param fileFilters List of {@link String} which are properties file
+     */
     public void setFileFilters( List fileFilters )
     {
         this.fileFilters = fileFilters;
     }
 
+    /**
+     * @return List of {@link String} file extensions to not filtering
+     */
     public List getNonFilteredFileExtensions()
     {
         return nonFilteredFileExtensions;
     }
 
+    /**
+     * @param nonFilteredFileExtensions List of {@link String} file extensions to not filtering
+     */
     public void setNonFilteredFileExtensions( List nonFilteredFileExtensions )
     {
         this.nonFilteredFileExtensions = nonFilteredFileExtensions;
@@ -167,11 +197,17 @@ public class MavenResourcesExecution
         this.mavenSession = mavenSession;
     }
 
+    /**
+     * @return List of {@link FilterWrapper}
+     */
     public List getFilterWrappers()
     {
         return filterWrappers;
     }
 
+    /**
+     * @param interpolators List of {@link FilterWrapper}
+     */
     public void setFilterWrappers( List filterWrappers )
     {
         this.filterWrappers = filterWrappers;
@@ -185,7 +221,40 @@ public class MavenResourcesExecution
         }
         this.filterWrappers.add( filterWrapper );
     }
+    
+    /**
+     * Helper to add {@link FilterWrapper}, will {@link RegexBasedInterpolator} with default regex Exp ${ } 
+     * and InterpolatorFilterReader with defaultTokens ${ }
+     * @param valueSource 
+     */
+    public void addFilerWrapper( final ValueSource valueSource )
+    {
+        addFilterWrapper( new FileUtils.FilterWrapper()
+        {
+            public Reader getReader( Reader reader )
+            {
+                Interpolator propertiesInterpolator = new RegexBasedInterpolator();
+                propertiesInterpolator.addValueSource( valueSource );
+                return new InterpolatorFilterReader( reader, propertiesInterpolator );
+            }
+        } );
+    }
 
+    public void addFilerWrapper( final ValueSource valueSource, final String startRegExp, final String endRegExp,
+                                 final String startToken, final String endToken )
+    {
+        addFilterWrapper( new FileUtils.FilterWrapper()
+        {
+            public Reader getReader( Reader reader )
+            {
+                Interpolator propertiesInterpolator = new RegexBasedInterpolator( startRegExp, endRegExp );
+                propertiesInterpolator.addValueSource( valueSource );
+                return new InterpolatorFilterReader( reader, propertiesInterpolator, startToken, endToken );
+            }
+        } );
+    }    
+    
+    
     public File getResourcesBaseDirectory()
     {
         return resourcesBaseDirectory;
diff --git a/src/main/java/org/apache/maven/shared/filtering/PropertiesEscapingBackSlahValueSource.java b/src/main/java/org/apache/maven/shared/filtering/PropertiesEscapingBackSlahValueSource.java
new file mode 100755
index 0000000..bc98355
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/PropertiesEscapingBackSlahValueSource.java
@@ -0,0 +1,57 @@
+package org.apache.maven.shared.filtering;
+
+/*
+ * 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.util.Properties;
+
+import org.codehaus.plexus.interpolation.ValueSource;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 21 juil. 2008
+ * @version $Id$
+ */
+public class PropertiesEscapingBackSlahValueSource
+    implements ValueSource
+{
+
+    private boolean escapedBackslashesInFilePath;
+    
+    private Properties properties;
+    
+    /**
+     * 
+     */
+    public PropertiesEscapingBackSlahValueSource(boolean escapedBackslashesInFilePath, Properties properties)
+    {
+        this.escapedBackslashesInFilePath = escapedBackslashesInFilePath;
+        this.properties = properties == null ? new Properties() : properties;
+    }
+
+    /** 
+     * @see org.codehaus.plexus.interpolation.ValueSource#getValue(java.lang.String)
+     */
+    public Object getValue( String expression )
+    {
+        String value = properties.getProperty( expression );
+        return escapedBackslashesInFilePath ? FilteringUtils.escapeWindowsPath( value ) : value;
+    }
+
+}
diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
index aa4fdf3..c574195 100755
--- a/src/site/apt/index.apt
+++ b/src/site/apt/index.apt
@@ -48,6 +48,8 @@ Maven Filtering Component
     
     * interpolation with token $\{ \} and values from mavenProject interpolation
     
+    * interpolation with token @ @ and values from mavenProject interpolation
+    
     []
     
     The values (Properties object) used for interpolation are loaded with the following order :
diff --git a/src/site/apt/usage.apt b/src/site/apt/usage.apt
index 8c6a0bc..740381f 100755
--- a/src/site/apt/usage.apt
+++ b/src/site/apt/usage.apt
@@ -3,7 +3,7 @@
  ------
  Olivier Lamy
  ------
- 2008-02-18
+ 2008-07-21
  ------
 
  ~~ Licensed to the Apache Software Foundation (ASF) under one
@@ -68,6 +68,7 @@ mavenResourcesFiltering.filterResources( mavenResourcesExecution );
 
   You must use the other methods from the MavenResourcesFiltering component and construct your own List of FilterWrapper.
   The following example add the interpolation for the Token @ @ with using values coming from reflection with the Maven Project.
+  NOTE : the component maven-filtering use the plexus-interpolation component
 
 +-----+
 
@@ -75,16 +76,22 @@ Create your FilterWrapper.
 
 FileUtils.FilterWrapper filterWrapper = new FileUtils.FilterWrapper()
 {
-    public Reader getReader( Reader reader )
-    {
-        ReflectionProperties reflectionProperties = new ReflectionProperties( mavenProject, true );
-        return new InterpolationFilterReader( reader, reflectionProperties, "@", "@" );
-    }
+  public Reader getReader( Reader reader )
+  {
+      Interpolator propertiesInterpolator = new RegexBasedInterpolator(  "\\@", "(.+?)\\@" );
+      propertiesInterpolator.addValueSource( valueSource );
+      return new InterpolatorFilterReader( reader, propertiesInterpolator, "@", "@" );
+  }
 };
 
 Create your MavenResourcesExecution instance and add a new filterWrapper.
 
-mavenResourcesExecution.addFilterWrapper( filterWrapper ); 
+mavenResourcesExecution.addFilterWrapper( filterWrapper );
+
+Or with the helper method :
+
+mavenResourcesExecution.addFilerWrapper( new MavenProjectValueSource( mavenProject, true ), "\\@", "(.+?)\\@", "@", "@" );
+ 
 If the mavenResourcesExecution.useDefaultFilterWrappers is set to true default FilterWrapper will be added first. 
 
 here you can apply filtering on your resources.
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index b1f995f..ae814b4 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -22,19 +22,15 @@ package org.apache.maven.shared.filtering;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.Reader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
-import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.InterpolationFilterReader;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -140,24 +136,26 @@ public class DefaultMavenResourcesFilteringTest
         throws Exception
     {
         assertEquals( 7, outputDirectory.listFiles().length );
-        Properties result = PropertyUtils.loadPropertyFile( new File( outputDirectory,
-                                                                      "empty-maven-resources-filtering.txt" ), null );
+        Properties result = new Properties();
+        result.load( new FileInputStream( new File( outputDirectory, "empty-maven-resources-filtering.txt" ) ) );
+
         assertTrue( result.isEmpty() );
 
-        result = PropertyUtils.loadPropertyFile( new File( outputDirectory, "maven-resources-filtering.txt" ), null );
+        result = new Properties();
+        result.load( new FileInputStream( new File( outputDirectory, "maven-resources-filtering.txt" ) ) );
         assertFalse( result.isEmpty() );
 
         assertEquals( "1.0", result.get( "version" ) );
         assertEquals( "org.apache", result.get( "groupId" ) );
         assertEquals( "bar", result.get( "foo" ) );
-        // FIXME this can fail with a windows path
-        String base = result.getProperty( "base" );
 
         assertEquals( "@@", result.getProperty( "emptyexpression" ) );
         assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
+        assertEquals( System.getProperty( "user.dir" ), result.getProperty( "userDir" ) );
         assertEquals( System.getProperty( "java.version" ), result.getProperty( "javaVersion" ) );
 
         assertEquals( baseDir.toString(), result.get( "base" ) );
+        assertEquals( new File( baseDir.toString() ).getPath(), new File( result.getProperty( "base" ) ).getPath() );
 
         File imageFile = new File( outputDirectory, "happy_duke.gif" );
         assertTrue( imageFile.exists() );
@@ -196,20 +194,12 @@ public class DefaultMavenResourcesFilteringTest
 
         List nonFilteredFileExtensions = Collections.singletonList( "gif" );
 
-        FileUtils.FilterWrapper filterWrapper = new FileUtils.FilterWrapper()
-        {
-            public Reader getReader( Reader reader )
-            {
-                ReflectionProperties reflectionProperties = new ReflectionProperties( mavenProject, true );
-                return new InterpolationFilterReader( reader, reflectionProperties, "@", "@" );
-            }
-        };
-
         MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory,
                                                                                        mavenProject, null, null,
                                                                                        nonFilteredFileExtensions,
                                                                                        new StubMavenSession() );
-        mavenResourcesExecution.addFilterWrapper( filterWrapper );
+
+        mavenResourcesExecution.addFilerWrapper( new MavenProjectValueSource( mavenProject, true ), "\\@", "(.+?)\\@", "@", "@" );
         mavenResourcesFiltering.filterResources( mavenResourcesExecution );
 
         Properties result = PropertyUtils
diff --git a/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
index dc8a510..6edb40f 100755
--- a/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
+++ b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
@@ -38,7 +38,6 @@ public class TestReflectionProperties
     public void testSimpleFiltering()
         throws Exception
     {
-        Properties allProperties = System.getProperties();
         FileInputStream readFileInputStream = null;
         try
         {
@@ -72,7 +71,6 @@ public class TestReflectionProperties
             {
                 readFileInputStream.close();
             }
-            System.setProperties( allProperties );
         }
 
     }
@@ -80,7 +78,6 @@ public class TestReflectionProperties
     public void testSimpleNonFiltering()
         throws Exception
     {
-        Properties allProperties = System.getProperties();
         FileInputStream readFileInputStream = null;
         try
         {
@@ -114,7 +111,6 @@ public class TestReflectionProperties
             {
                 readFileInputStream.close();
             }
-            System.setProperties( allProperties );
         }
 
     }    
diff --git a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
index 9065b59..15152f4 100755
--- a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
+++ b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
@@ -20,6 +20,7 @@ version=${pom.version}
 groupId=${pom.groupId}
 foo=${foo}
 none=none filtered
+userDir=@user.dir@
 base=${pom.basedir}
 emptyexpression=@@
 emptyexpression2=${}


[maven-filtering] 33/44: [MRESOURCES-62] changed message from "default encoding" to "platform encoding (xxx actually)" to be more explicit

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit a18a5896dc168cebd2a80e2238d6eda754ca926f
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Mar 24 20:40:59 2008 +0000

    [MRESOURCES-62] changed message from "default encoding" to "platform encoding (xxx actually)" to be more explicit
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@640565 13f79535-47bb-0310-9956-ffa450edef68
---
 .../maven/shared/filtering/DefaultMavenResourcesFiltering.java       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index b0257c4..54a468b 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -33,6 +33,7 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
 
 /**
@@ -152,11 +153,11 @@ public class DefaultMavenResourcesFiltering
 
         if ( mavenResourcesExecution.getEncoding() == null || mavenResourcesExecution.getEncoding().length() < 1 )
         {
-            getLogger().info( "Using default encoding to copy filtered resources." );
+            getLogger().info( "Using platform encoding (" + ReaderFactory.FILE_ENCODING + " actually) to copy filtered resources." );
         }
         else
         {
-            getLogger().info( "Using '" + mavenResourcesExecution.getEncoding() + "' to copy filtered resources." );
+            getLogger().info( "Using '" + mavenResourcesExecution.getEncoding() + "' encoding to copy filtered resources." );
         }
         
         for ( Iterator i = mavenResourcesExecution.getResources().iterator(); i.hasNext(); )


[maven-filtering] 17/44: move a method from private to public

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit b1eca6ce084f95340f85b3bdc7c570fc4aa2794a
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sun Feb 17 21:43:20 2008 +0000

    move a method from private to public
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@628553 13f79535-47bb-0310-9956-ffa450edef68
---
 .../maven/shared/filtering/DefaultMavenResourcesFiltering.java      | 6 +++---
 .../org/apache/maven/shared/filtering/MavenResourcesFiltering.java  | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index f9122c5..3449e2f 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -158,7 +158,7 @@ public class DefaultMavenResourcesFiltering
                 {
                     destinationFile.getParentFile().mkdirs();
                 }
-                boolean filteredExt = filteredFileExtension( source, nonFilteredFileExtensions );
+                boolean filteredExt = filteredFileExtension( source.getName(), nonFilteredFileExtensions );
                 mavenFileFilter.copyFile( source, destinationFile, resource.isFiltering() && filteredExt,
                                           filterWrappers, encoding );
             }
@@ -167,14 +167,14 @@ public class DefaultMavenResourcesFiltering
     }
 
     
-    private boolean filteredFileExtension( File file, List userNonFilteredFileExtensions )
+    public boolean filteredFileExtension( String fileName, List userNonFilteredFileExtensions )
     {
         List nonFilteredFileExtensions = new ArrayList( getDefaultNonFilteredFileExtensions() );
         if ( userNonFilteredFileExtensions != null )
         {
             nonFilteredFileExtensions.addAll( userNonFilteredFileExtensions );
         }
-        return !nonFilteredFileExtensions.contains( StringUtils.lowerCase( FileUtils.extension( file.getName() ) ) );
+        return !nonFilteredFileExtensions.contains( StringUtils.lowerCase( FileUtils.extension( fileName ) ) );
     }
 
     public List getDefaultNonFilteredFileExtensions()
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
index be0b638..843ed86 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -63,4 +63,6 @@ public interface MavenResourcesFiltering
      * @return {@link List} of {@link String}
      */
     public List getDefaultNonFilteredFileExtensions();
+    
+    boolean filteredFileExtension( String fileName, List userNonFilteredFileExtensions );
 }


[maven-filtering] 12/44: fix javadoc

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 1607cfb1008c5395ee2bd236dcf68a5323097971
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Feb 9 22:29:52 2008 +0000

    fix javadoc
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@620208 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java  | 2 +-
 .../org/apache/maven/shared/filtering/MavenResourcesFiltering.java    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index 8fc4a59..a1f8c81 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -41,7 +41,7 @@ public interface MavenFileFilter
      * @param to destination file
      * @param filtering enable or not filering
      * @param mavenProject the mavenproject
-     * @param filters {@link List} of properties file 
+     * @param filters {@link List} of String which are path to a Property file
      * @throws IOException 
      */
     void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject, List filters,
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
index 5acba81..9819db1 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -36,8 +36,8 @@ public interface MavenResourcesFiltering
      * @param resources {@link List} of {@link Resource}
      * @param outputDirectory parent destination directory
      * @param mavenProject
-     * @param encoding
-     * @param fileFilters {@link List} of Properties file
+     * @param encoding 
+     * @param fileFilters {@link List} of String which are path to a Property file 
      * @throws MavenFilteringException
      */
     void filterResources( List resources, File outputDirectory, MavenProject mavenProject, String encoding,


[maven-filtering] 18/44: update documentation merge duplicate code

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 9447d00a721cae20e62abed5fbd8bfd91dd8e39a
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Feb 18 22:19:43 2008 +0000

    update documentation
    merge duplicate code
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@628894 13f79535-47bb-0310-9956-ffa450edef68
---
 .../shared/filtering/DefaultMavenFileFilter.java   | 83 ++++++++--------------
 .../maven/shared/filtering/MavenFileFilter.java    |  1 -
 .../shared/filtering/MavenResourcesFiltering.java  | 14 ++--
 .../maven/shared/filtering/PropertyUtils.java      |  4 ++
 src/site/apt/index.apt                             | 24 +++++--
 5 files changed, 61 insertions(+), 65 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index bf7709b..a089ab9 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -87,69 +87,20 @@ public class DefaultMavenFileFilter
         filterProperties.putAll( System.getProperties() );
 
         // Project properties
-        filterProperties.putAll( mavenProject.getProperties() == null ? Collections.EMPTY_MAP : mavenProject.getProperties() );
+        filterProperties.putAll( mavenProject.getProperties() == null ? Collections.EMPTY_MAP : mavenProject
+            .getProperties() );
 
         // Take a copy of filterProperties to ensure that evaluated filterTokens are not propagated
         // to subsequent filter files. NB this replicates current behaviour and seems to make sense.
         final Properties baseProps = new Properties();
         baseProps.putAll( filterProperties );
 
-        if ( filters != null )
-        {
-            for ( Iterator i = filters.iterator(); i.hasNext(); )
-            {
-                String filterfile = (String) i.next();
-                try
-                {
-                    Properties properties = PropertyUtils.loadPropertyFile( new File( filterfile ), baseProps );
-                    filterProperties.putAll( properties );
-                }
-                catch ( IOException e )
-                {
-                    throw new MavenFilteringException( "Error loading property file '" + filterfile + "'", e );
-                }
-            }
-        }
-        
-        List buildFilters = mavenProject.getFilters();
-        if ( buildFilters != null )
-        {
-            for ( Iterator iterator = buildFilters.iterator(); iterator.hasNext(); )
-            {
-                String filterFile = (String) iterator.next();
-                try
-                {
+        loadProperties( filterProperties, filters, baseProps );
 
-                    Properties properties = PropertyUtils.loadPropertyFile( new File( filterFile ), baseProps );
-                    filterProperties.putAll( properties );
-                }
-                catch ( IOException e )
-                {
-                    throw new MavenFilteringException( "Error loading property file '" + filterFile + "'", e );
-                }
-            }
-        }
+        loadProperties( filterProperties, mavenProject.getFilters(), baseProps );
 
-        buildFilters = mavenProject.getBuild().getFilters();
-        if ( buildFilters != null )
-        {
-            for ( Iterator iterator = buildFilters.iterator(); iterator.hasNext(); )
-            {
-                String filterFile = (String) iterator.next();
-                try
-                {
+        loadProperties( filterProperties, mavenProject.getBuild().getFilters(), baseProps );
 
-                    Properties properties = PropertyUtils.loadPropertyFile( new File( filterFile ), baseProps );
-                    filterProperties.putAll( properties );
-                }
-                catch ( IOException e )
-                {
-                    throw new MavenFilteringException( "Error loading property file '" + filterFile + "'", e );
-                }
-            }
-        }
-
-       
         List defaultFilterWrappers = new ArrayList( 3 );
 
         // support ${token}
@@ -181,10 +132,32 @@ public class DefaultMavenFileFilter
                 return new InterpolationFilterReader( reader, reflectionProperties, "${", "}" );
             }
         };
-        
+
         defaultFilterWrappers.add( third );
 
         return defaultFilterWrappers;
     }
 
+    private void loadProperties( Properties filterProperties, List /*String*/propertiesFilePaths, Properties baseProps )
+        throws MavenFilteringException
+    {
+        if ( propertiesFilePaths != null )
+        {
+            for ( Iterator iterator = propertiesFilePaths.iterator(); iterator.hasNext(); )
+            {
+                String filterFile = (String) iterator.next();
+                try
+                {
+                    // TODO new File should be new File(mavenProject.getBasedir(), filterfile ) ? 
+                    Properties properties = PropertyUtils.loadPropertyFile( new File( filterFile ), baseProps );
+                    filterProperties.putAll( properties );
+                }
+                catch ( IOException e )
+                {
+                    throw new MavenFilteringException( "Error loading property file '" + filterFile + "'", e );
+                }
+            }
+        }
+    }
+
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index a1f8c81..8c17c08 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -20,7 +20,6 @@ package org.apache.maven.shared.filtering;
  */
 
 import java.io.File;
-import java.io.IOException;
 import java.util.List;
 
 import org.apache.maven.project.MavenProject;
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
index 843ed86..498b936 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -35,8 +35,8 @@ public interface MavenResourcesFiltering
     /**
      * @param resources {@link List} of {@link org.apache.maven.model.Resource}
      * @param outputDirectory parent destination directory
-     * @param mavenProject
-     * @param encoding 
+     * @param mavenProject the maven project
+     * @param encoding encoding to use for writing files
      * @param fileFilters {@link List} of String which are path to a Property file 
      * @param nonFilteredFileExtensions {@link List} of String for non filtered file extensions
      * @throws MavenFilteringException
@@ -48,7 +48,7 @@ public interface MavenResourcesFiltering
     /**
      * @param resources {@link List} of {@link org.apache.maven.model.Resource}
      * @param outputDirectory parent destination directory
-     * @param encoding
+     * @param encoding encoding to use for writing files
      * @param filterWrappers {@link List} of FileUtils.FilterWrapper
      * @param resourcesBaseDirectory baseDirectory of resources
      * @param nonFilteredFileExtensions {@link List} of String for non filtered file extensions
@@ -62,7 +62,13 @@ public interface MavenResourcesFiltering
      * return the List of the non filtered extensions (jpg,jpeg,gif,bmp,png)
      * @return {@link List} of {@link String}
      */
-    public List getDefaultNonFilteredFileExtensions();
+    List getDefaultNonFilteredFileExtensions();
     
+    /**
+     * @param fileName the file name
+     * @param userNonFilteredFileExtensions an extra list of file extensions 
+     * @return true if filtering can be apply to the file (means extensions.lowerCase is in the 
+     *         default List or in the user defined extension List)
+     */
     boolean filteredFileExtension( String fileName, List userNonFilteredFileExtensions );
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
index 8e7ada0..8dff312 100755
--- a/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
+++ b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
@@ -106,6 +106,7 @@ public final class PropertyUtils
      * @param fail wheter to throw an exception when the file cannot be loaded or to return null
      * @param useSystemProps wheter to incorporate System.getProperties settings into the returned Properties object.
      * @return the loaded and fully resolved Properties object
+     * @throws IOException if profile does not exist, or cannot be read.
      */
     public static Properties loadPropertyFile( File propfile, boolean fail, boolean useSystemProps )
         throws IOException
@@ -149,6 +150,9 @@ public final class PropertyUtils
      * the value of a property contains a key), and will
      * not loop endlessly on a pair like
      * test = ${test}.
+     * @param k
+     * @param p
+     * @return 
      */
     private static String getPropertyValue( String k, Properties p )
     {
diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
index 5a1354c..709d13d 100755
--- a/src/site/apt/index.apt
+++ b/src/site/apt/index.apt
@@ -25,14 +25,17 @@
 
 Maven Filtering Component
 
-  This Plexus components has been build with the filtering process coming from the maven-resources-plugin.
+  This Plexus components has been build with the filtering process/code coming from the maven-resources-plugin.
   
   The goal is to provide a common way for all plugins which needs to filtering resources. 
   
 * Component MavenResourcesFiltering
 
   This component will apply filtering on a List of org.apache.maven.model.Resource. 
-  The method without the filterWrappers parameter will interpolate the files using the default FileUtils.FilterWrapper. 
+  
+  The method without the filterWrappers parameter will interpolate the files using the default List of FileUtils.FilterWrapper (see above). 
+  
+  The component will not filtering some predefined file extensions (jpg,jpeg,gif,bmp,png). Note : you can easily add extra file extensions.
 
 * Component MavenFileFilter
 
@@ -47,6 +50,17 @@ Maven Filtering Component
     
     []
     
-    <<NOTE>> : The sentence "values from SystemProps, project.properties, filters, project.filters and project.build.filters" 
-    means pairs of key/value will be loaded/overriding with this order. The value for key java.version can be overriding 
-    with a property in the maven project (yes crazy but possible).
\ No newline at end of file
+    The values (Properties object) used for interpolation are loaded with the following order :
+    
+    * System Properties
+    
+    * List of properties ( the method has a parameter which accept a List of String -> path properties files )
+    
+    * pom.filters
+    
+    * pom.build.filters
+    
+    []
+    
+    <<NOTE>> : As it's a Properties object, last defined key/value pair wins . 
+    The value for key java.version can be overriding with a property in the maven project (yes crazy but possible).
\ No newline at end of file


[maven-filtering] 20/44: fix documentation

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 09751f3d134613409f4282effa59b1f24e48fca8
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Tue Feb 19 08:40:44 2008 +0000

    fix documentation
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@629025 13f79535-47bb-0310-9956-ffa450edef68
---
 src/site/apt/index.apt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
index 709d13d..6d79423 100755
--- a/src/site/apt/index.apt
+++ b/src/site/apt/index.apt
@@ -54,6 +54,8 @@ Maven Filtering Component
     
     * System Properties
     
+    * pom.properties
+    
     * List of properties ( the method has a parameter which accept a List of String -> path properties files )
     
     * pom.filters
@@ -63,4 +65,4 @@ Maven Filtering Component
     []
     
     <<NOTE>> : As it's a Properties object, last defined key/value pair wins . 
-    The value for key java.version can be overriding with a property in the maven project (yes crazy but possible).
\ No newline at end of file
+    The value for key java.version can be overriding with a property in the maven project (yes crazy but possible).


[maven-filtering] 10/44: fix some checkstyle errors

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit d01b93a372d6e57908934951815050f55cdeb755
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Thu Feb 7 22:14:13 2008 +0000

    fix some checkstyle errors
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@619666 13f79535-47bb-0310-9956-ffa450edef68
---
 .../shared/filtering/DefaultMavenFileFilter.java   | 26 ++++++++-------------
 .../filtering/DefaultMavenResourcesFiltering.java  |  3 ++-
 .../maven/shared/filtering/MavenFileFilter.java    | 15 ++++++------
 .../shared/filtering/MavenFilteringException.java  |  3 ++-
 .../shared/filtering/MavenResourcesFiltering.java  |  8 +++----
 .../maven/shared/filtering/PropertyUtils.java      | 27 +++++++++++++---------
 .../shared/filtering/ReflectionProperties.java     |  6 ++---
 7 files changed, 43 insertions(+), 45 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index 0437f11..1467c36 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 import java.io.File;
 import java.io.IOException;
@@ -42,10 +43,7 @@ import org.codehaus.plexus.util.InterpolationFilterReader;
 public class DefaultMavenFileFilter
     implements MavenFileFilter
 {
-    
-    /** 
-     * @see org.apache.maven.shared.filtering.MavenFileFilter#copyFile(java.io.File, java.io.File, boolean, org.apache.maven.project.MavenProject, java.util.List)
-     */
+
     public void copyFile( File from, File to, boolean filtering, MavenProject mavenProject, List filters,
                           boolean escapedBackslashesInFilePath, String encoding )
         throws MavenFilteringException
@@ -54,9 +52,6 @@ public class DefaultMavenFileFilter
         copyFile( from, to, filtering, filterWrappers, encoding );
     }
 
-    /** 
-     * @see org.apache.maven.shared.filtering.MavenFileFilter#copyFile(java.io.File, java.io.File, boolean, java.util.List)
-     */
     public void copyFile( File from, File to, boolean filtering, List filterWrappers, String encoding )
         throws MavenFilteringException
     {
@@ -81,9 +76,6 @@ public class DefaultMavenFileFilter
 
     }
 
-    /** 
-     * @see org.apache.maven.shared.filtering.MavenFileFilter#getDefaultFilterWrappers(org.apache.maven.project.MavenProject, java.util.List)
-     */
     public List getDefaultFilterWrappers( final MavenProject mavenProject, List filters,
                                           final boolean escapedBackslashesInFilePath )
         throws MavenFilteringException
@@ -121,9 +113,9 @@ public class DefaultMavenFileFilter
         }
         
         List buildFilters = mavenProject.getFilters();
-        if (buildFilters != null)
+        if ( buildFilters != null )
         {
-            for (Iterator iterator = buildFilters.iterator();iterator.hasNext();)
+            for ( Iterator iterator = buildFilters.iterator(); iterator.hasNext(); )
             {
                 String filterFile = (String) iterator.next();
                 try
@@ -137,12 +129,12 @@ public class DefaultMavenFileFilter
                     throw new MavenFilteringException( "Error loading property file '" + filterFile + "'", e );
                 }
             }
-        }        
-        
+        }
+
         buildFilters = mavenProject.getBuild().getFilters();
-        if (buildFilters != null)
+        if ( buildFilters != null )
         {
-            for (Iterator iterator = buildFilters.iterator();iterator.hasNext();)
+            for ( Iterator iterator = buildFilters.iterator(); iterator.hasNext(); )
             {
                 String filterFile = (String) iterator.next();
                 try
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index be4e863..d02f4ec 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 import java.io.File;
 import java.util.Arrays;
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index ea8a452..8fc4a59 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 import java.io.File;
 import java.io.IOException;
@@ -34,7 +35,7 @@ public interface MavenFileFilter
     
     /**
      * Will copy a file with some filtering using defaultFilterWrappers 
-     * @see #getDefaultFilterWrappers(MavenProject, List)
+     * @see #getDefaultFilterWrappers(MavenProject, List, boolean)
      * 
      * @param from file to copy/filter
      * @param to destination file
@@ -43,7 +44,7 @@ public interface MavenFileFilter
      * @param filters {@link List} of properties file 
      * @throws IOException 
      */
-    public void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject, List filters,
+    void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject, List filters,
                           boolean escapedBackslashesInFilePath, String encoding )
         throws MavenFilteringException;
 
@@ -54,7 +55,7 @@ public interface MavenFileFilter
      * @param filterWrappers {@link List} of FileUtils.FilterWrapper
      * @throws MavenFilteringException
      */
-    public void copyFile( File from, final File to, boolean filtering, List filterWrappers, String encoding )
+    void copyFile( File from, final File to, boolean filtering, List filterWrappers, String encoding )
         throws MavenFilteringException;
 
     /**
@@ -62,8 +63,8 @@ public interface MavenFileFilter
      * Will return the default FileUtils.FilterWrappers
      * 
      * <ul>
-     *   <li>interpolation with token ${ } and values from System.getProperties, project.getProperties, from filters and project filters.</li>
-     *   <li>interpolation with token @ @ and values from System.getProperties, project.getProperties, from filters and project filters.</li>
+     *   <li>interpolation with token ${ } and values from SystemProps, project.properties, from filters and project filters.</li>
+     *   <li>interpolation with token @ @ and values from SystemProps, project.properties, from filters and project filters.</li>
      *   <li>interpolation with token ${ } and values from mavenProject interpolation.</li>
      * </ul>
      * 
@@ -73,6 +74,6 @@ public interface MavenFileFilter
      * @return {@link List} of FileUtils.FilterWrapper 
      * 
      */
-    public List getDefaultFilterWrappers( MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath )
+    List getDefaultFilterWrappers( MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath )
         throws MavenFilteringException;
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java b/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java
index 25cb808..0a72f99 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,7 +18,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
index bae9373..5acba81 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -1,3 +1,5 @@
+package org.apache.maven.shared.filtering;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,13 +18,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.shared.filtering;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.List;
 
-import org.apache.maven.model.Resource;
 import org.apache.maven.project.MavenProject;
 
 /**
@@ -40,9 +39,8 @@ public interface MavenResourcesFiltering
      * @param encoding
      * @param fileFilters {@link List} of Properties file
      * @throws MavenFilteringException
-     * @throws IOException
      */
-    public void filterResources( List resources, File outputDirectory, MavenProject mavenProject, String encoding,
+    void filterResources( List resources, File outputDirectory, MavenProject mavenProject, String encoding,
                                  List fileFilters )
         throws MavenFilteringException;
 
diff --git a/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
index df94eda..8e7ada0 100755
--- a/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
+++ b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
@@ -18,6 +18,7 @@ package org.apache.maven.shared.filtering;
  * specific language governing permissions and limitations
  * under the License.
  */
+
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -36,6 +37,9 @@ import java.util.Properties;
  */
 public final class PropertyUtils
 {
+    /**
+     * private empty constructor to prevent instantiation
+     */
     private PropertyUtils()
     {
         // prevent instantiation
@@ -44,8 +48,8 @@ public final class PropertyUtils
     /**
      * Reads a property file, resolving all internal variables, using the supplied base properties.
      * <p>
-     * The properties are resolved iteratively, so if the value of property A refers to property B, then after resolution
-     * the value of property B will contain the value of property B.
+     * The properties are resolved iteratively, so if the value of property A refers to property B, 
+     * then after resolution the value of property B will contain the value of property B.
      * </p>
      * 
      * @param propFile The property file to load.
@@ -109,26 +113,27 @@ public final class PropertyUtils
         
         final Properties baseProps = new Properties();
 
-        if (useSystemProps) 
+        if ( useSystemProps )
         {
-            baseProps.putAll(System.getProperties());
+            baseProps.putAll( System.getProperties() );
         }
 
         final Properties resolvedProps = new Properties();
-        try 
+        try
         {
-            resolvedProps.putAll(loadPropertyFile(propfile, baseProps));
-        } catch (FileNotFoundException e)
+            resolvedProps.putAll( loadPropertyFile( propfile, baseProps ) );
+        }
+        catch ( FileNotFoundException e )
         {
-            if (fail) 
+            if ( fail )
             {
-                throw new FileNotFoundException(propfile.toString());
+                throw new FileNotFoundException( propfile.toString() );
             }
         }
 
-        if (useSystemProps) 
+        if ( useSystemProps )
         {
-            resolvedProps.putAll(baseProps);
+            resolvedProps.putAll( baseProps );
         }
 
         return resolvedProps;
diff --git a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
index 2663eac..dd35a46 100755
--- a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
+++ b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
@@ -38,11 +38,11 @@ public class ReflectionProperties
 
     private MavenProject project;
 
-    boolean escapedBackslashesInFilePath;
+    private boolean escapedBackslashesInFilePath;
 
     public ReflectionProperties( MavenProject mavenProject  ) 
     {
-       this(mavenProject, false);
+       this( mavenProject, false );
     }    
     
     public ReflectionProperties( MavenProject mavenProject, boolean escapedBackslashesInFilePath ) 
@@ -56,7 +56,7 @@ public class ReflectionProperties
     
     public Object get( Object key )
     {
-        if (key == null || StringUtils.isEmpty( key.toString() ))
+        if ( key == null || StringUtils.isEmpty( key.toString() ) )
         {
             return null;
         }


[maven-filtering] 35/44: use last parent

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 2a0196d3bc9997c69343a0fbe2a55299ed9892ac
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat May 10 13:47:16 2008 +0000

    use last parent
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@655086 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 8f2f3c6..0490ed7 100755
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache.maven.shared</groupId>
     <artifactId>maven-shared-components</artifactId>
-    <version>8</version>
+    <version>9</version>
   </parent>
 
   <prerequisites>


[maven-filtering] 07/44: add unit on PropertyUtils

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit ab64b03234d71115c2f8458128c6d6ad579a3b9c
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Feb 4 21:22:15 2008 +0000

    add unit on PropertyUtils
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@618443 13f79535-47bb-0310-9956-ffa450edef68
---
 .../maven/shared/filtering/PropertyUtilsTest.java  | 101 +++++++++++++++++++++
 1 file changed, 101 insertions(+)

diff --git a/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java b/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java
new file mode 100755
index 0000000..70d3fe0
--- /dev/null
+++ b/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.util.Properties;
+
+import org.codehaus.plexus.PlexusTestCase;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 4 f�vr. 08
+ * @version $Id$
+ */
+public class PropertyUtilsTest
+    extends PlexusTestCase
+{
+    private static File testDirectory = new File( getBasedir(), "target/test-classes/" );
+    
+    
+
+    public void testBasic()
+        throws Exception
+    {
+        File basicProp = new File( testDirectory, "basic.properties" );
+
+        if ( basicProp.exists() )
+        {
+            basicProp.delete();
+        }
+
+        basicProp.createNewFile();
+        FileWriter writer = new FileWriter( basicProp );
+
+        writer.write( "ghost=${non_existent}\n" );
+        writer.write( "key=${untat_na_damgo}\n" );
+        writer.write( "untat_na_damgo=gani_man\n" );
+        writer.flush();
+        writer.close();
+
+        Properties prop = PropertyUtils.loadPropertyFile( basicProp, false, false );
+        assertTrue( prop.getProperty( "key" ).equals( "gani_man" ) );
+        assertTrue( prop.getProperty( "ghost" ).equals( "${non_existent}" ) );
+    }
+
+    public void testSystemProperties()
+        throws Exception
+    {
+        File systemProp = new File( testDirectory, "system.properties" );
+
+        if ( systemProp.exists() )
+        {
+            systemProp.delete();
+        }
+
+        systemProp.createNewFile();
+        FileWriter writer = new FileWriter( systemProp );
+
+        writer.write( "key=${user.dir}" );
+        writer.flush();
+        writer.close();
+
+        Properties prop = PropertyUtils.loadPropertyFile( systemProp, false, true );
+        assertTrue( prop.getProperty( "key" ).equals( System.getProperty( "user.dir" ) ) );
+    }
+
+    public void testException()
+        throws Exception
+    {
+        File nonExistent = new File( testDirectory, "not_existent_file" );
+
+        assertFalse( "property file exist: " + nonExistent.toString(), nonExistent.exists() );
+
+        try
+        {
+            PropertyUtils.loadPropertyFile( nonExistent, true, false );
+            assertTrue( "Exception failed", false );
+        }
+        catch ( Exception ex )
+        {
+            // exception ok
+        }
+    }
+}


[maven-filtering] 04/44: add a plexus component which aplly filtering on List of org.apache.maven.model.Resource

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 790d3a224209599cc76694127a391039cac0c6e3
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Jan 28 23:21:03 2008 +0000

    add a plexus component which aplly filtering on List of org.apache.maven.model.Resource
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@616103 13f79535-47bb-0310-9956-ffa450edef68
---
 .../shared/filtering/DefaultMavenFileFilter.java   |  38 +++---
 .../filtering/DefaultMavenResourcesFiltering.java  | 133 +++++++++++++++++++++
 .../maven/shared/filtering/MavenFileFilter.java    |  11 +-
 .../shared/filtering/MavenResourcesFiltering.java  |  49 ++++++++
 .../maven/shared/filtering/PropertyUtils.java      |   4 +-
 .../DefaultMavenResourcesFilteringTest.java        | 116 ++++++++++++++++++
 .../maven/shared/filtering/StubMavenProject.java   |  46 +++++++
 .../empty-maven-resources-filtering.txt            |  18 +++
 .../maven-resources-filtering.txt                  |  22 ++++
 9 files changed, 413 insertions(+), 24 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
index b6551dc..fe58371 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.Reader;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
@@ -35,7 +36,8 @@ import org.codehaus.plexus.util.InterpolationFilterReader;
  * @since 22 janv. 08
  * @version $Id$
  * 
- * @plexus.component role="org.apache.maven.shared.filtering.MavenFileFilter" role-hint="default"
+ * @plexus.component role="org.apache.maven.shared.filtering.MavenFileFilter" 
+ *                   role-hint="default"
  */
 public class DefaultMavenFileFilter
     implements MavenFileFilter
@@ -82,17 +84,18 @@ public class DefaultMavenFileFilter
     /** 
      * @see org.apache.maven.shared.filtering.MavenFileFilter#getDefaultFilterWrappers(org.apache.maven.project.MavenProject, java.util.List)
      */
-    public List getDefaultFilterWrappers( final MavenProject mavenProject, List filters, final boolean escapedBackslashesInFilePath )
+    public List getDefaultFilterWrappers( final MavenProject mavenProject, List filters,
+                                          final boolean escapedBackslashesInFilePath )
         throws MavenFilteringException
     {
-        
+
         final Properties filterProperties = new Properties();
 
         // System properties
         filterProperties.putAll( System.getProperties() );
 
         // Project properties
-        filterProperties.putAll( mavenProject.getProperties() );
+        filterProperties.putAll( mavenProject.getProperties() == null ? Collections.EMPTY_MAP : mavenProject.getProperties() );
 
         // Take a copy of filterProperties to ensure that evaluated filterTokens are not propagated
         // to subsequent filter files. NB this replicates current behaviour and seems to make sense.
@@ -116,21 +119,25 @@ public class DefaultMavenFileFilter
                 }
             }
         }
-        
-        List defaultFilterWrappers = new ArrayList(3);
-        
+
+        List defaultFilterWrappers = new ArrayList( 3 );
+
         // support ${token}
-        FileUtils.FilterWrapper one = new FileUtils.FilterWrapper() {
-            public Reader getReader(Reader reader) {
-                return new InterpolationFilterReader(reader, filterProperties, "${", "}");
+        FileUtils.FilterWrapper one = new FileUtils.FilterWrapper()
+        {
+            public Reader getReader( Reader reader )
+            {
+                return new InterpolationFilterReader( reader, filterProperties, "${", "}" );
             }
         };
         defaultFilterWrappers.add( one );
-        
+
         // support @token@
-        FileUtils.FilterWrapper second = new FileUtils.FilterWrapper() {
-            public Reader getReader(Reader reader) {
-                return new InterpolationFilterReader(reader, filterProperties, "@", "@");
+        FileUtils.FilterWrapper second = new FileUtils.FilterWrapper()
+        {
+            public Reader getReader( Reader reader )
+            {
+                return new InterpolationFilterReader( reader, filterProperties, "@", "@" );
             }
         };
         defaultFilterWrappers.add( second );
@@ -145,8 +152,7 @@ public class DefaultMavenFileFilter
             }
         };
         defaultFilterWrappers.add( third );
-        
-        
+
         return defaultFilterWrappers;
     }
 
diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
new file mode 100755
index 0000000..be4e863
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -0,0 +1,133 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.model.Resource;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.DirectoryScanner;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 28 janv. 08
+ * @version $Id$
+ * 
+ * @plexus.component role="org.apache.maven.shared.filtering.MavenResourcesFiltering" 
+ *                   role-hint="default"
+ */
+public class DefaultMavenResourcesFiltering
+    implements MavenResourcesFiltering
+{
+
+    private static final String[] EMPTY_STRING_ARRAY = {};
+
+    private static final String[] DEFAULT_INCLUDES = {"**/**"};
+    
+    /**
+     * @plexus.requirement
+     *  role-hint="default"
+     */
+    private MavenFileFilter mavenFileFilter;
+    
+    public void filterResources( List resources, File outputDirectory, MavenProject mavenProject, String encoding,
+                                 List fileFilters )
+        throws MavenFilteringException
+    {
+        for ( Iterator i = resources.iterator(); i.hasNext(); )
+        {
+            Resource resource = (Resource) i.next();
+
+            String targetPath = resource.getTargetPath();
+
+            File resourceDirectory = new File( resource.getDirectory() );
+            if ( !resourceDirectory.isAbsolute() )
+            {
+                resourceDirectory = new File( mavenProject.getBasedir(), resourceDirectory.getPath() );
+            }
+
+            if ( !resourceDirectory.exists() )
+            {
+                // TODO how to log here ?
+                continue;
+            }
+
+            // this part is required in case the user specified "../something" as destination
+            // see MNG-1345
+            if ( !outputDirectory.exists() )
+            {
+                if ( !outputDirectory.mkdirs() )
+                {
+                    throw new MavenFilteringException( "Cannot create resource output directory: " + outputDirectory );
+                }
+            }
+
+            DirectoryScanner scanner = new DirectoryScanner();
+
+            scanner.setBasedir( resourceDirectory );
+            if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() )
+            {
+                scanner.setIncludes( (String[]) resource.getIncludes().toArray( EMPTY_STRING_ARRAY ) );
+            }
+            else
+            {
+                scanner.setIncludes( DEFAULT_INCLUDES );
+            }
+
+            if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() )
+            {
+                scanner.setExcludes( (String[]) resource.getExcludes().toArray( EMPTY_STRING_ARRAY ) );
+            }
+
+            scanner.addDefaultExcludes();
+            scanner.scan();
+
+            List includedFiles = Arrays.asList( scanner.getIncludedFiles() );
+
+            List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, fileFilters, true );            
+            
+            for ( Iterator j = includedFiles.iterator(); j.hasNext(); )
+            {
+                String name = (String) j.next();
+
+                String destination = name;
+
+                if ( targetPath != null )
+                {
+                    destination = targetPath + "/" + name;
+                }
+
+                File source = new File( resourceDirectory, name );
+
+                File destinationFile = new File( outputDirectory, destination );
+
+                if ( !destinationFile.getParentFile().exists() )
+                {
+                    destinationFile.getParentFile().mkdirs();
+                }
+                mavenFileFilter.copyFile( source, destinationFile, resource.isFiltering(), filterWrappers, encoding );
+            }
+        }
+
+    }
+
+}
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
index e8f32ff..a0c29ac 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java
@@ -43,18 +43,18 @@ public interface MavenFileFilter
      * @param filters {@link List} of properties file 
      * @throws IOException 
      */
-    public void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject,
-                          List/* File */filters, boolean escapedBackslashesInFilePath, String encoding )
+    public void copyFile( File from, final File to, boolean filtering, MavenProject mavenProject, List filters,
+                          boolean escapedBackslashesInFilePath, String encoding )
         throws MavenFilteringException;
 
     /**
      * @param from
      * @param to
      * @param filtering
-     * @param filterWrappers
+     * @param filterWrappers {@link List} of FileUtils.FilterWrapper
      * @throws MavenFilteringException
      */
-    public void copyFile( File from, final File to, boolean filtering, List /*FileUtils.FilterWrapper*/filterWrappers, String encoding )
+    public void copyFile( File from, final File to, boolean filtering, List filterWrappers, String encoding )
         throws MavenFilteringException;
 
     /**
@@ -73,7 +73,6 @@ public interface MavenFileFilter
      * @return {@link List} of FileUtils.FilterWrapper 
      * 
      */
-    public List/*FileUtils.FilterWrapper*/getDefaultFilterWrappers( MavenProject mavenProject, List/* File */filters,
-                                                                     boolean escapedBackslashesInFilePath )
+    public List getDefaultFilterWrappers( MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath )
         throws MavenFilteringException;
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
new file mode 100755
index 0000000..bae9373
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.maven.model.Resource;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 28 janv. 08
+ * @version $Id$
+ */
+public interface MavenResourcesFiltering
+{
+
+    /**
+     * @param resources {@link List} of {@link Resource}
+     * @param outputDirectory parent destination directory
+     * @param mavenProject
+     * @param encoding
+     * @param fileFilters {@link List} of Properties file
+     * @throws MavenFilteringException
+     * @throws IOException
+     */
+    public void filterResources( List resources, File outputDirectory, MavenProject mavenProject, String encoding,
+                                 List fileFilters )
+        throws MavenFilteringException;
+
+}
diff --git a/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
index 424d689..3f1e1c9 100755
--- a/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
+++ b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
@@ -72,7 +72,7 @@ public final class PropertyUtils
         }
 
         final Properties combinedProps = new Properties();
-        combinedProps.putAll( baseProps );
+        combinedProps.putAll( baseProps == null ? new Properties() : baseProps );
         combinedProps.putAll( fileProps );
 
         // The algorithm iterates only over the fileProps which is all that is required to resolve
@@ -185,7 +185,7 @@ public final class PropertyUtils
             // else prefix the original string with the
             // resolved property ( so it can be parsed further )
             // taking recursion into account.
-            if ( nv == null || nv.equals( k ) )
+            if ( nv == null || nv.equals( k ) || k.equals( nk ) )
             {
                 ret += "${" + nk + "}";
             }
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
new file mode 100755
index 0000000..aacc834
--- /dev/null
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.model.Resource;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 28 janv. 08
+ * @version $Id$
+ */
+public class DefaultMavenResourcesFilteringTest
+    extends PlexusTestCase
+{
+
+    File outputDirectory = new File(getBasedir(), "target/DefaultMavenResourcesFilteringTest");
+    
+
+    
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+        if ( outputDirectory.exists() )
+        {
+            FileUtils.forceDelete( outputDirectory );
+        }
+        outputDirectory.mkdirs();
+    }
+    
+    public void testSimpleFiltering()
+        throws Exception
+    {
+        StubMavenProject mavenProject = new StubMavenProject();
+        mavenProject.setVersion( "1.0" );
+        mavenProject.setGroupId( "org.apache" );
+
+        Properties projectProperties = new Properties();
+        projectProperties.put( "foo", "bar" );        
+        mavenProject.setProperties( projectProperties );
+        MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
+            .getName() );
+
+        Resource resource = new Resource();
+        List resources = new ArrayList();
+        resources.add( resource );
+        resource.setDirectory( getBasedir() + "/src/test/units-files/maven-resources-filtering" );
+        resource.setFiltering( true );
+        mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, null );
+       
+        assertEquals( 2, outputDirectory.listFiles().length );
+        Properties result = PropertyUtils.loadPropertyFile( new File(outputDirectory, "empty-maven-resources-filtering.txt"), null );
+        assertTrue (result.isEmpty());
+        
+        result = PropertyUtils.loadPropertyFile( new File(outputDirectory, "maven-resources-filtering.txt"), null );
+        assertFalse( result.isEmpty() );
+        
+        assertEquals("1.0", result.get( "version" ));
+        assertEquals("org.apache", result.get( "groupId" ));
+        assertEquals("bar", result.get( "foo" ));
+    }
+    
+    public void testNoFiltering()
+        throws Exception
+    {
+        StubMavenProject mavenProject = new StubMavenProject();
+        mavenProject.setVersion( "1.0" );
+        mavenProject.setGroupId( "org.apache" );
+
+        MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
+            .getName() );
+
+        Resource resource = new Resource();
+        List resources = new ArrayList();
+        resources.add( resource );
+        resource.setDirectory( getBasedir() + "/src/test/units-files/maven-resources-filtering" );
+        resource.setFiltering( false );
+        mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, null );
+
+        assertEquals( 2, outputDirectory.listFiles().length );
+        Properties result = PropertyUtils.loadPropertyFile( new File( outputDirectory,
+                                                                      "empty-maven-resources-filtering.txt" ), null );
+        assertTrue( result.isEmpty() );
+
+        result = PropertyUtils.loadPropertyFile( new File( outputDirectory, "maven-resources-filtering.txt" ), null );
+        assertFalse( result.isEmpty() );
+
+        assertEquals( "${pom.version}", result.get( "version" ) );
+        assertEquals( "${pom.groupId}", result.get( "groupId" ) );
+        assertEquals( "${foo}", result.get( "foo" ) );
+    }    
+}
diff --git a/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java b/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java
new file mode 100755
index 0000000..b7ce5ab
--- /dev/null
+++ b/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.util.Properties;
+
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 28 janv. 08
+ * @version $Id$
+ */
+public class StubMavenProject
+    extends MavenProject
+{
+    private Properties properties;
+
+    public Properties getProperties()
+    {
+        return this.properties;
+    }
+
+    public void setProperties( Properties properties )
+    {
+        this.properties = properties;
+    }
+
+
+}
diff --git a/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt b/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt
new file mode 100755
index 0000000..eb3e59f
--- /dev/null
+++ b/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt
@@ -0,0 +1,18 @@
+#/*
+# * 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.
+# */
\ No newline at end of file
diff --git a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
new file mode 100755
index 0000000..022a0a0
--- /dev/null
+++ b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
@@ -0,0 +1,22 @@
+#/*
+# * 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.
+# */
+version=${pom.version}
+groupId=${pom.groupId}
+foo=${foo}
+none=none filtered
\ No newline at end of file


[maven-filtering] 28/44: add some logging and a null check

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 6b38f465f2bbdb167082f4043cb6efa848c066c0
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Wed Feb 27 22:25:40 2008 +0000

    add some logging and a null check
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@631757 13f79535-47bb-0310-9956-ffa450edef68
---
 .../filtering/DefaultMavenResourcesFiltering.java  | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index 1846d10..05706d4 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -28,6 +28,7 @@ import java.util.List;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.util.DirectoryScanner;
@@ -43,6 +44,7 @@ import org.codehaus.plexus.util.StringUtils;
  *                   role-hint="default"
  */
 public class DefaultMavenResourcesFiltering
+    extends AbstractLogEnabled
     implements MavenResourcesFiltering, Initializable
 {
 
@@ -122,6 +124,18 @@ public class DefaultMavenResourcesFiltering
         {
             throw new MavenFilteringException( "mavenResourcesExecution cannot be null" );
         }
+        
+        if ( mavenResourcesExecution.getResources() == null )
+        {
+            getLogger().info( "No resources configured skip copying/filtering" );
+            return;
+        }
+        
+        if ( mavenResourcesExecution.getOutputDirectory() == null )
+        {
+            throw new MavenFilteringException( "outputDirectory cannot be null" );
+        }
+        
         if ( mavenResourcesExecution.isUseDefaultFilterWrappers() )
         {
             List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenResourcesExecution.getMavenProject(),
@@ -131,6 +145,15 @@ public class DefaultMavenResourcesFiltering
             mavenResourcesExecution.setFilterWrappers( filterWrappers );
         }
 
+        if ( mavenResourcesExecution.getEncoding() == null || mavenResourcesExecution.getEncoding().length() < 1 )
+        {
+            getLogger().info( "Using default encoding to copy filtered resources." );
+        }
+        else
+        {
+            getLogger().info( "Using '" + mavenResourcesExecution.getEncoding() + "' to copy filtered resources." );
+        }
+        
         for ( Iterator i = mavenResourcesExecution.getResources().iterator(); i.hasNext(); )
         {
             Resource resource = (Resource) i.next();
@@ -184,6 +207,10 @@ public class DefaultMavenResourcesFiltering
 
             List includedFiles = Arrays.asList( scanner.getIncludedFiles() );
 
+            getLogger().info(
+                              "Copying " + includedFiles.size() + " resource" + ( includedFiles.size() > 1 ? "s" : "" )
+                                  + ( targetPath == null ? "" : " to " + targetPath ) );            
+            
             for ( Iterator j = includedFiles.iterator(); j.hasNext(); )
             {
                 String name = (String) j.next();


[maven-filtering] 03/44: ignore eclipse files

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit eb5690f583f161cb30b3a547ace72b148dca7870
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Thu Jan 24 00:32:14 2008 +0000

    ignore eclipse files
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@614755 13f79535-47bb-0310-9956-ffa450edef68


[maven-filtering] 06/44: remove a printStackTrace

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 73709fa83328b8372ab2b19e114c3724c65a018d
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Thu Jan 31 23:51:07 2008 +0000

    remove a printStackTrace
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@617304 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/maven/shared/filtering/ReflectionProperties.java     | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
index f398658..b0ed590 100755
--- a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
+++ b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
@@ -89,7 +89,6 @@ public class ReflectionProperties
         catch ( Exception e ) 
         {
             //TODO: remove the try-catch block when ReflectionValueExtractor.evaluate() throws no more exceptions
-            e.printStackTrace();
         } 
         return value;
     }


[maven-filtering] 13/44: add a method which allow users to have their own list of FilterWrappers

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 0ff416e9b56827c5f62d0c718b5c18b311832341
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Feb 9 23:07:04 2008 +0000

    add a method which allow users to have their own list of FilterWrappers
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@620211 13f79535-47bb-0310-9956-ffa450edef68
---
 .../shared/filtering/DefaultMavenResourcesFiltering.java | 16 ++++++++++++----
 .../maven/shared/filtering/MavenResourcesFiltering.java  | 12 +++++++++++-
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index d02f4ec..1d6aecc 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -54,6 +54,14 @@ public class DefaultMavenResourcesFiltering
                                  List fileFilters )
         throws MavenFilteringException
     {
+        List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, fileFilters, true );
+
+        filterResources( resources, outputDirectory, encoding, filterWrappers, mavenProject.getBasedir() );
+    }
+
+    public void filterResources( List resources, File outputDirectory, String encoding, List filterWrappers, File resourcesBaseDirectory )
+        throws MavenFilteringException
+    {
         for ( Iterator i = resources.iterator(); i.hasNext(); )
         {
             Resource resource = (Resource) i.next();
@@ -63,7 +71,7 @@ public class DefaultMavenResourcesFiltering
             File resourceDirectory = new File( resource.getDirectory() );
             if ( !resourceDirectory.isAbsolute() )
             {
-                resourceDirectory = new File( mavenProject.getBasedir(), resourceDirectory.getPath() );
+                resourceDirectory = new File( resourcesBaseDirectory, resourceDirectory.getPath() );
             }
 
             if ( !resourceDirectory.exists() )
@@ -103,8 +111,6 @@ public class DefaultMavenResourcesFiltering
             scanner.scan();
 
             List includedFiles = Arrays.asList( scanner.getIncludedFiles() );
-
-            List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, fileFilters, true );            
             
             for ( Iterator j = includedFiles.iterator(); j.hasNext(); )
             {
@@ -128,7 +134,9 @@ public class DefaultMavenResourcesFiltering
                 mavenFileFilter.copyFile( source, destinationFile, resource.isFiltering(), filterWrappers, encoding );
             }
         }
-
+        
     }
 
+    
+    
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
index 9819db1..8ba557c 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -33,7 +33,7 @@ public interface MavenResourcesFiltering
 {
 
     /**
-     * @param resources {@link List} of {@link Resource}
+     * @param resources {@link List} of {@link org.apache.maven.model.Resource}
      * @param outputDirectory parent destination directory
      * @param mavenProject
      * @param encoding 
@@ -44,4 +44,14 @@ public interface MavenResourcesFiltering
                                  List fileFilters )
         throws MavenFilteringException;
 
+    
+    /**
+     * @param resources {@link List} of {@link org.apache.maven.model.Resource}
+     * @param outputDirectory parent destination directory
+     * @param encoding
+     * @param filterWrappers {@link List} of FileUtils.FilterWrapper
+     * @throws MavenFilteringException
+     */
+    void filterResources( List resources, File outputDirectory, String encoding, List filterWrappers, File resourcesBaseDirectory )
+        throws MavenFilteringException;    
 }


[maven-filtering] 19/44: add : - unit with adding token - test escaping windows path - usage page with code samples

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 06f6dc182063a5407a9d53b4769f4d46c7bea262
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Tue Feb 19 00:02:39 2008 +0000

    add :
    - unit with adding token
    - test escaping windows path
    - usage page with code samples
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@628928 13f79535-47bb-0310-9956-ffa450edef68
---
 src/site/apt/usage.apt                             | 85 ++++++++++++++++++++++
 src/site/site.xml                                  |  1 +
 .../DefaultMavenResourcesFilteringTest.java        | 64 +++++++++++++++-
 .../maven-resources-filtering.txt                  |  3 +-
 4 files changed, 150 insertions(+), 3 deletions(-)

diff --git a/src/site/apt/usage.apt b/src/site/apt/usage.apt
new file mode 100755
index 0000000..3584ab5
--- /dev/null
+++ b/src/site/apt/usage.apt
@@ -0,0 +1,85 @@
+ ------
+ Basic Usage
+ ------
+ Olivier Lamy
+ ------
+ 2008-02-18
+ ------
+
+ ~~ 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.
+
+Maven Filtering Component Basic Usage
+
+* Filtering a List of org.apache.maven.model.Resource. 
+  
+  Lookup the component in your Mojo
+  
++-----+
+  
+    /**
+     * @component role="org.apache.maven.shared.filtering.MavenResourcesFiltering" role-hint="default"
+     * @required
+     */    
+    private MavenResourcesFiltering mavenResourcesFiltering;
+  
++-----+
+
+  Apply filtering on your resources List (see {{{../index.html}Reference}} to see the default FilterWrappers used).
+
++-----+
+
+encoding can be null platform default will be used
+
+nonFilteredFileExtensions : is a List of String which file extensions to not apply filtering (default List contains jpg,jpeg,gif,bmp,png)
+
+mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, encoding, filtersFile, nonFilteredFileExtensions );
+
++-----+
+
+* Adding new filtering Token
+
+  You must use the other methods from the MavenResourcesFiltering component and construct your own List of FilterWrapper.
+  The following example add the interpolation for the Token @ @ with using values coming from reflection with the Maven Project.
+
++-----+
+
+MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" );
+List defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, null, true );
+
+List filterWrappers = new ArrayList( );
+filterWrappers.addAll( defaultFilterWrappers );
+FileUtils.FilterWrapper filterWrapper = new FileUtils.FilterWrapper()
+{
+    public Reader getReader( Reader reader )
+    {
+        ReflectionProperties reflectionProperties = new ReflectionProperties( mavenProject, true );
+        return new InterpolationFilterReader( reader, reflectionProperties, "@", "@" );
+    }
+};
+filterWrappers.add( filterWrapper );
+
+here you can apply filtering on your resources.
+
+encoding can be null platform default will be used
+
+nonFilteredFileExtensions : is a List of String which file extensions to not apply filtering (default List contains jpg,jpeg,gif,bmp,png)
+
+mavenResourcesFiltering.filterResources( resources, outputDirectory, encoding, filterWrappers,
+                                         outputDirectory, nonFilteredFileExtensions );
+
++-----+
diff --git a/src/site/site.xml b/src/site/site.xml
index 4afb631..7033f1f 100755
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -37,6 +37,7 @@ under the License.
   <body>
     <menu name="Overview">
       <item name="Reference" href="index.html"/>
+      <item name="Usage" href="usage.html"/>
     </menu>
     <!-- TODO: Link, head, reports should be inherited -->
     <!-- TODO: use breadcrumbs more structure, links for links, and inherit subprojects as a menu or not at all -->
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index 73e396f..8668ee6 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -22,15 +22,18 @@ package org.apache.maven.shared.filtering;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.Reader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
 import org.apache.maven.model.Resource;
+import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.InterpolationFilterReader;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -56,12 +59,15 @@ public class DefaultMavenResourcesFilteringTest
         outputDirectory.mkdirs();
     }
     
+   
     public void testSimpleFiltering()
         throws Exception
     {
-        StubMavenProject mavenProject = new StubMavenProject( new File( getBasedir() ) );
+        File baseDir = new File( "c:\\foo\\bar" );
+        StubMavenProject mavenProject = new StubMavenProject( baseDir );
         mavenProject.setVersion( "1.0" );
         mavenProject.setGroupId( "org.apache" );
+        mavenProject.setName( "test project" );
 
         Properties projectProperties = new Properties();
         projectProperties.put( "foo", "bar" );
@@ -97,18 +103,72 @@ public class DefaultMavenResourcesFilteringTest
         assertEquals("bar", result.get( "foo" ));
         // FIXME this can fail with a windows path
         String base = result.getProperty( "base" );
-        assertEquals(getBasedir(), base);
         
         assertEquals( "@@", result.getProperty( "emptyexpression" ) );
         assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
         assertEquals( "zloug", result.getProperty( "javaVersion" ) );
         
+        assertEquals( baseDir.toString(), result.get( "base" ) );
+        
         File imageFile = new File(outputDirectory, "happy_duke.gif");
         assertTrue( imageFile.exists() );
         //assertEquals( initialImageFile.length(), imageFile.length() );
         assertTrue(filesAreIdentical( initialImageFile, imageFile ));
     }
     
+    public void testaddingTokens()
+        throws Exception
+    {
+        File baseDir = new File( "c:\\foo\\bar" );
+        final StubMavenProject mavenProject = new StubMavenProject( baseDir );
+        mavenProject.setVersion( "1.0" );
+        mavenProject.setGroupId( "org.apache" );
+        mavenProject.setName( "test project" );
+
+        Properties projectProperties = new Properties();
+        projectProperties.put( "foo", "bar" );
+        projectProperties.put( "java.version", "zloug" );
+        mavenProject.setProperties( projectProperties );
+        MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
+            .getName() );
+
+        String unitFilesDir = getBasedir() + "/src/test/units-files/maven-resources-filtering";
+        File initialImageFile = new File( unitFilesDir, "happy_duke.gif" );
+
+        Resource resource = new Resource();
+        List resources = new ArrayList();
+        resources.add( resource );
+        resource.setDirectory( unitFilesDir );
+        resource.setFiltering( true );
+
+        List filtersFile = new ArrayList();
+        filtersFile.add( getBasedir()
+            + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
+
+        List nonFilteredFileExtensions = Collections.singletonList( "gif" );
+        
+        MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" );
+        List defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, null, true );
+
+        List filterWrappers = new ArrayList( );
+        filterWrappers.addAll( defaultFilterWrappers );
+        FileUtils.FilterWrapper filterWrapper = new FileUtils.FilterWrapper()
+        {
+            public Reader getReader( Reader reader )
+            {
+                ReflectionProperties reflectionProperties = new ReflectionProperties( mavenProject, true );
+                return new InterpolationFilterReader( reader, reflectionProperties, "@", "@" );
+            }
+        };
+        filterWrappers.add( filterWrapper );
+        mavenResourcesFiltering.filterResources( resources, outputDirectory, null, filterWrappers,
+                                                 new File( getBasedir() ), nonFilteredFileExtensions );
+        
+        Properties result = PropertyUtils.loadPropertyFile( new File(outputDirectory, "maven-resources-filtering.txt"), null );
+        assertFalse( result.isEmpty() );
+        assertEquals( mavenProject.getName(), result.get( "pomName" ) );
+    }
+    
     public void testNoFiltering()
         throws Exception
     {
diff --git a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
index 47eaa4e..9065b59 100755
--- a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
+++ b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
@@ -23,4 +23,5 @@ none=none filtered
 base=${pom.basedir}
 emptyexpression=@@
 emptyexpression2=${}
-javaVersion=${java.version}
\ No newline at end of file
+javaVersion=${java.version}
+pomName=@pom.name@
\ No newline at end of file


[maven-filtering] 09/44: if the resource contains empty expressions (${} or @@) the component filtered with a complex object toString or could failed to getSystemProperty

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 76bc4172bee64fafd0d9b0110070b4f5573b3eb6
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Wed Feb 6 21:42:23 2008 +0000

    if the resource contains empty expressions (${} or @@) the component filtered with a complex object toString or could failed to getSystemProperty
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@619165 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java   | 3 ++-
 .../java/org/apache/maven/shared/filtering/ReflectionProperties.java | 5 +++++
 .../maven/shared/filtering/DefaultMavenResourcesFilteringTest.java   | 5 +++++
 .../maven-resources-filtering/maven-resources-filtering.txt          | 4 +++-
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
index 3f1e1c9..df94eda 100755
--- a/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
+++ b/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
@@ -19,6 +19,7 @@ package org.apache.maven.shared.filtering;
  * under the License.
  */
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -175,7 +176,7 @@ public final class PropertyUtils
             String nv = p.getProperty( nk );
 
             // try global environment..
-            if ( nv == null )
+            if ( nv == null && !StringUtils.isEmpty( nk ) )
             {
                 nv = System.getProperty( nk );
             }
diff --git a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
index b0ed590..2663eac 100755
--- a/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
+++ b/src/main/java/org/apache/maven/shared/filtering/ReflectionProperties.java
@@ -56,6 +56,11 @@ public class ReflectionProperties
     
     public Object get( Object key )
     {
+        if (key == null || StringUtils.isEmpty( key.toString() ))
+        {
+            return null;
+        }
+        
         Object value = null;
         try 
         {
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index 10741e9..0fe15c4 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -84,6 +84,9 @@ public class DefaultMavenResourcesFilteringTest
         // FIXME this can fail with a windows path
         String base = result.getProperty( "base" );
         assertEquals(getBasedir(), base);
+        
+        assertEquals( "@@", result.getProperty( "emptyexpression" ) );
+        assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
     }
     
     public void testNoFiltering()
@@ -114,5 +117,7 @@ public class DefaultMavenResourcesFilteringTest
         assertEquals( "${pom.version}", result.get( "version" ) );
         assertEquals( "${pom.groupId}", result.get( "groupId" ) );
         assertEquals( "${foo}", result.get( "foo" ) );
+        assertEquals( "@@", result.getProperty( "emptyexpression" ) );
+        assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
     }    
 }
diff --git a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
index d5b56d1..3826b6f 100755
--- a/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
+++ b/src/test/units-files/maven-resources-filtering/maven-resources-filtering.txt
@@ -20,4 +20,6 @@ version=${pom.version}
 groupId=${pom.groupId}
 foo=${foo}
 none=none filtered
-base=${pom.basedir}
\ No newline at end of file
+base=${pom.basedir}
+emptyexpression=@@
+emptyexpression2=${}
\ No newline at end of file


[maven-filtering] 27/44: add a bean to configure a filtering execution request this will prevent having methods with dozens of parameters

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 9371ad39af52db25ca89bce10c0b91045786123a
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Wed Feb 27 22:06:51 2008 +0000

    add a bean to configure a filtering execution request
    this will prevent having methods with dozens of parameters
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@631749 13f79535-47bb-0310-9956-ffa450edef68
---
 .../filtering/DefaultMavenResourcesFiltering.java  |  78 +++++---
 .../shared/filtering/MavenResourcesExecution.java  | 209 +++++++++++++++++++++
 .../shared/filtering/MavenResourcesFiltering.java  |   7 +
 .../DefaultMavenResourcesFilteringTest.java        | 125 ++++++++----
 4 files changed, 355 insertions(+), 64 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
index b4df098..1846d10 100755
--- a/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
@@ -79,17 +79,59 @@ public class DefaultMavenResourcesFiltering
                                  List fileFilters, List nonFilteredFileExtensions, MavenSession mavenSession )
         throws MavenFilteringException
     {
-        List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, fileFilters, true, mavenSession );
-
-        filterResources( resources, outputDirectory, encoding, filterWrappers, mavenProject.getBasedir(),
-                         nonFilteredFileExtensions );
+        MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory,
+                                                                                       mavenProject, encoding,
+                                                                                       fileFilters,
+                                                                                       nonFilteredFileExtensions,
+                                                                                       mavenSession );
+        mavenResourcesExecution.setUseDefaultFilterWrappers( true );
+        filterResources( mavenResourcesExecution );
     }
 
     public void filterResources( List resources, File outputDirectory, String encoding, List filterWrappers,
                                  File resourcesBaseDirectory, List nonFilteredFileExtensions )
         throws MavenFilteringException
     {
-        for ( Iterator i = resources.iterator(); i.hasNext(); )
+        MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory,
+                                                                                       encoding, filterWrappers,
+                                                                                       resourcesBaseDirectory,
+                                                                                       nonFilteredFileExtensions );
+        filterResources( mavenResourcesExecution );
+    }
+
+    
+    public boolean filteredFileExtension( String fileName, List userNonFilteredFileExtensions )
+    {
+        List nonFilteredFileExtensions = new ArrayList( getDefaultNonFilteredFileExtensions() );
+        if ( userNonFilteredFileExtensions != null )
+        {
+            nonFilteredFileExtensions.addAll( userNonFilteredFileExtensions );
+        }
+        return !nonFilteredFileExtensions.contains( StringUtils.lowerCase( FileUtils.extension( fileName ) ) );
+    }
+
+    public List getDefaultNonFilteredFileExtensions()
+    {
+        return this.defaultNonFilteredFileExtensions;
+    }
+
+    public void filterResources( MavenResourcesExecution mavenResourcesExecution )
+        throws MavenFilteringException
+    {
+        if ( mavenResourcesExecution == null )
+        {
+            throw new MavenFilteringException( "mavenResourcesExecution cannot be null" );
+        }
+        if ( mavenResourcesExecution.isUseDefaultFilterWrappers() )
+        {
+            List filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenResourcesExecution.getMavenProject(),
+                                                                            mavenResourcesExecution.getFileFilters(),
+                                                                            true, mavenResourcesExecution
+                                                                                .getMavenSession() );
+            mavenResourcesExecution.setFilterWrappers( filterWrappers );
+        }
+
+        for ( Iterator i = mavenResourcesExecution.getResources().iterator(); i.hasNext(); )
         {
             Resource resource = (Resource) i.next();
 
@@ -99,7 +141,8 @@ public class DefaultMavenResourcesFiltering
 
             if ( !resourceDirectory.isAbsolute() )
             {
-                resourceDirectory = new File( resourcesBaseDirectory, resourceDirectory.getPath() );
+                resourceDirectory = new File( mavenResourcesExecution.getResourcesBaseDirectory(), resourceDirectory
+                    .getPath() );
             }
 
             if ( !resourceDirectory.exists() )
@@ -110,6 +153,7 @@ public class DefaultMavenResourcesFiltering
 
             // this part is required in case the user specified "../something" as destination
             // see MNG-1345
+            File outputDirectory = mavenResourcesExecution.getOutputDirectory();
             if ( !outputDirectory.exists() )
             {
                 if ( !outputDirectory.mkdirs() )
@@ -159,29 +203,15 @@ public class DefaultMavenResourcesFiltering
                 {
                     destinationFile.getParentFile().mkdirs();
                 }
-                boolean filteredExt = filteredFileExtension( source.getName(), nonFilteredFileExtensions );
+                boolean filteredExt = filteredFileExtension( source.getName(), mavenResourcesExecution
+                    .getNonFilteredFileExtensions() );
                 mavenFileFilter.copyFile( source, destinationFile, resource.isFiltering() && filteredExt,
-                                          filterWrappers, encoding );
+                                          mavenResourcesExecution.getFilterWrappers(), mavenResourcesExecution
+                                              .getEncoding() );
             }
         }
 
     }
-
-    
-    public boolean filteredFileExtension( String fileName, List userNonFilteredFileExtensions )
-    {
-        List nonFilteredFileExtensions = new ArrayList( getDefaultNonFilteredFileExtensions() );
-        if ( userNonFilteredFileExtensions != null )
-        {
-            nonFilteredFileExtensions.addAll( userNonFilteredFileExtensions );
-        }
-        return !nonFilteredFileExtensions.contains( StringUtils.lowerCase( FileUtils.extension( fileName ) ) );
-    }
-
-    public List getDefaultNonFilteredFileExtensions()
-    {
-        return this.defaultNonFilteredFileExtensions;
-    }
     
     
 }
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java
new file mode 100755
index 0000000..330fe6f
--- /dev/null
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java
@@ -0,0 +1,209 @@
+/*
+ * 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.
+ */
+package org.apache.maven.shared.filtering;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils.FilterWrapper;
+
+/**
+ * A bean to configure a resources filtering execution
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 27 f�vr. 2008
+ * @version $Id$
+ */
+public class MavenResourcesExecution
+{
+
+    private List resources;
+
+    private File outputDirectory;
+
+    private MavenProject mavenProject;
+
+    private String encoding;
+
+    private List fileFilters;
+
+    private List nonFilteredFileExtensions;
+
+    private MavenSession mavenSession;
+
+    private List filterWrappers;
+
+    private File resourcesBaseDirectory;
+
+    private boolean useDefaultFilterWrappers = false;
+    
+    
+    public MavenResourcesExecution()
+    {
+        // nothing here just add an empty constructor for java bean convention
+    }
+    
+    /**
+     * <b>As we use a maven project useDefaultFilterWrappers will set to true</b>
+     * @param resources
+     * @param outputDirectory
+     * @param mavenProject
+     * @param encoding
+     * @param fileFilters
+     * @param nonFilteredFileExtensions
+     * @param mavenSession
+     */
+    public MavenResourcesExecution( List resources, File outputDirectory, MavenProject mavenProject, String encoding,
+                                    List fileFilters, List nonFilteredFileExtensions, MavenSession mavenSession )
+    {
+        this.resources = resources;
+        this.outputDirectory = outputDirectory;
+        this.mavenProject = mavenProject;
+        this.encoding = encoding;
+        this.fileFilters = fileFilters;
+        this.nonFilteredFileExtensions = nonFilteredFileExtensions;
+        this.mavenSession = mavenSession;
+        this.useDefaultFilterWrappers = true;
+        this.resourcesBaseDirectory = mavenProject.getBasedir();
+    }
+
+    public MavenResourcesExecution( List resources, File outputDirectory, String encoding, List filterWrappers,
+                                    File resourcesBaseDirectory, List nonFilteredFileExtensions )
+    {
+        this.resources = resources;
+        this.outputDirectory = outputDirectory;
+        this.encoding = encoding;
+        this.filterWrappers = filterWrappers;
+        this.nonFilteredFileExtensions = nonFilteredFileExtensions;
+        this.resourcesBaseDirectory = resourcesBaseDirectory;
+        this.useDefaultFilterWrappers = false;
+    }
+
+    public List getResources()
+    {
+        return resources;
+    }
+
+    public void setResources( List resources )
+    {
+        this.resources = resources;
+    }
+
+    public File getOutputDirectory()
+    {
+        return outputDirectory;
+    }
+
+    public void setOutputDirectory( File outputDirectory )
+    {
+        this.outputDirectory = outputDirectory;
+    }
+
+    public MavenProject getMavenProject()
+    {
+        return mavenProject;
+    }
+
+    public void setMavenProject( MavenProject mavenProject )
+    {
+        this.mavenProject = mavenProject;
+    }
+
+    public String getEncoding()
+    {
+        return encoding;
+    }
+
+    public void setEncoding( String encoding )
+    {
+        this.encoding = encoding;
+    }
+
+    public List getFileFilters()
+    {
+        return fileFilters;
+    }
+
+    public void setFileFilters( List fileFilters )
+    {
+        this.fileFilters = fileFilters;
+    }
+
+    public List getNonFilteredFileExtensions()
+    {
+        return nonFilteredFileExtensions;
+    }
+
+    public void setNonFilteredFileExtensions( List nonFilteredFileExtensions )
+    {
+        this.nonFilteredFileExtensions = nonFilteredFileExtensions;
+    }
+
+    public MavenSession getMavenSession()
+    {
+        return mavenSession;
+    }
+
+    public void setMavenSession( MavenSession mavenSession )
+    {
+        this.mavenSession = mavenSession;
+    }
+
+    public List getFilterWrappers()
+    {
+        return filterWrappers;
+    }
+
+    public void setFilterWrappers( List filterWrappers )
+    {
+        this.filterWrappers = filterWrappers;
+    }
+    
+    public void addFilterWrapper( FilterWrapper filterWrapper )
+    {
+        if ( this.filterWrappers == null )
+        {
+            this.filterWrappers = new ArrayList();
+        }
+        this.filterWrappers.add( filterWrapper );
+    }
+
+    public File getResourcesBaseDirectory()
+    {
+        return resourcesBaseDirectory;
+    }
+
+    public void setResourcesBaseDirectory( File resourcesBaseDirectory )
+    {
+        this.resourcesBaseDirectory = resourcesBaseDirectory;
+    }
+
+    public boolean isUseDefaultFilterWrappers()
+    {
+        return useDefaultFilterWrappers;
+    }
+
+    public void setUseDefaultFilterWrappers( boolean useDefaultFilterWrappers )
+    {
+        this.useDefaultFilterWrappers = useDefaultFilterWrappers;
+    }
+   
+}
diff --git a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
index 4e6998a..b2c55bd 100755
--- a/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
+++ b/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java
@@ -72,4 +72,11 @@ public interface MavenResourcesFiltering
      *         default List or in the user defined extension List)
      */
     boolean filteredFileExtension( String fileName, List userNonFilteredFileExtensions );
+    
+    /**
+     * @param mavenResourcesExecution
+     * @throws MavenFilteringException
+     */
+    void filterResources( MavenResourcesExecution mavenResourcesExecution )
+        throws MavenFilteringException;
 }
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index 383b27f..dcf3e14 100755
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -28,7 +28,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
@@ -58,8 +57,7 @@ public class DefaultMavenResourcesFilteringTest
         }
         outputDirectory.mkdirs();
     }
-    
-   
+
     public void testSimpleFiltering()
         throws Exception
     {
@@ -77,8 +75,8 @@ public class DefaultMavenResourcesFilteringTest
             .getName() );
 
         String unitFilesDir = getBasedir() + "/src/test/units-files/maven-resources-filtering";
-        File initialImageFile = new File(unitFilesDir, "happy_duke.gif");
-        
+        File initialImageFile = new File( unitFilesDir, "happy_duke.gif" );
+
         Resource resource = new Resource();
         List resources = new ArrayList();
         resources.add( resource );
@@ -86,38 +84,85 @@ public class DefaultMavenResourcesFilteringTest
         resource.setFiltering( true );
 
         List filtersFile = new ArrayList();
-        filtersFile.add( getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
-        
+        filtersFile.add( getBasedir()
+            + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
+
         List nonFilteredFileExtensions = Collections.singletonList( "gif" );
-        
+
         mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, filtersFile,
                                                  nonFilteredFileExtensions, new StubMavenSession() );
-       
+
+        assertFiltering( baseDir, initialImageFile );
+    }
+
+    public void testWithMavenResourcesExecution()
+        throws Exception
+    {
+        File baseDir = new File( "c:\\foo\\bar" );
+        StubMavenProject mavenProject = new StubMavenProject( baseDir );
+        mavenProject.setVersion( "1.0" );
+        mavenProject.setGroupId( "org.apache" );
+        mavenProject.setName( "test project" );
+
+        Properties projectProperties = new Properties();
+        projectProperties.put( "foo", "bar" );
+        projectProperties.put( "java.version", "zloug" );
+        mavenProject.setProperties( projectProperties );
+        MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class
+            .getName() );
+
+        String unitFilesDir = getBasedir() + "/src/test/units-files/maven-resources-filtering";
+        File initialImageFile = new File( unitFilesDir, "happy_duke.gif" );
+
+        Resource resource = new Resource();
+        List resources = new ArrayList();
+        resources.add( resource );
+        resource.setDirectory( unitFilesDir );
+        resource.setFiltering( true );
+
+        List filtersFile = new ArrayList();
+        filtersFile.add( getBasedir()
+            + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
+
+        List nonFilteredFileExtensions = Collections.singletonList( "gif" );
+        MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory,
+                                                                                       mavenProject, null, filtersFile,
+                                                                                       nonFilteredFileExtensions,
+                                                                                       new StubMavenSession() );
+
+        mavenResourcesFiltering.filterResources( mavenResourcesExecution );
+        assertFiltering( baseDir, initialImageFile );
+    }
+
+    private void assertFiltering( File baseDir, File initialImageFile )
+        throws Exception
+    {
         assertEquals( 3, outputDirectory.listFiles().length );
-        Properties result = PropertyUtils.loadPropertyFile( new File(outputDirectory, "empty-maven-resources-filtering.txt"), null );
-        assertTrue (result.isEmpty());
-        
-        result = PropertyUtils.loadPropertyFile( new File(outputDirectory, "maven-resources-filtering.txt"), null );
+        Properties result = PropertyUtils.loadPropertyFile( new File( outputDirectory,
+                                                                      "empty-maven-resources-filtering.txt" ), null );
+        assertTrue( result.isEmpty() );
+
+        result = PropertyUtils.loadPropertyFile( new File( outputDirectory, "maven-resources-filtering.txt" ), null );
         assertFalse( result.isEmpty() );
-        
-        assertEquals("1.0", result.get( "version" ));
-        assertEquals("org.apache", result.get( "groupId" ));
-        assertEquals("bar", result.get( "foo" ));
+
+        assertEquals( "1.0", result.get( "version" ) );
+        assertEquals( "org.apache", result.get( "groupId" ) );
+        assertEquals( "bar", result.get( "foo" ) );
         // FIXME this can fail with a windows path
         String base = result.getProperty( "base" );
-        
+
         assertEquals( "@@", result.getProperty( "emptyexpression" ) );
         assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
         assertEquals( System.getProperty( "java.version" ), result.getProperty( "javaVersion" ) );
-        
+
         assertEquals( baseDir.toString(), result.get( "base" ) );
-        
-        File imageFile = new File(outputDirectory, "happy_duke.gif");
+
+        File imageFile = new File( outputDirectory, "happy_duke.gif" );
         assertTrue( imageFile.exists() );
         //assertEquals( initialImageFile.length(), imageFile.length() );
-        assertTrue(filesAreIdentical( initialImageFile, imageFile ));
+        assertTrue( filesAreIdentical( initialImageFile, imageFile ) );
     }
-    
+
     public void testaddingTokens()
         throws Exception
     {
@@ -148,12 +193,12 @@ public class DefaultMavenResourcesFilteringTest
             + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" );
 
         List nonFilteredFileExtensions = Collections.singletonList( "gif" );
-        
+
         MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" );
         List defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenProject, null, true,
                                                                                new StubMavenSession() );
 
-        List filterWrappers = new ArrayList( );
+        List filterWrappers = new ArrayList();
         filterWrappers.addAll( defaultFilterWrappers );
         FileUtils.FilterWrapper filterWrapper = new FileUtils.FilterWrapper()
         {
@@ -166,12 +211,13 @@ public class DefaultMavenResourcesFilteringTest
         filterWrappers.add( filterWrapper );
         mavenResourcesFiltering.filterResources( resources, outputDirectory, null, filterWrappers,
                                                  new File( getBasedir() ), nonFilteredFileExtensions );
-        
-        Properties result = PropertyUtils.loadPropertyFile( new File(outputDirectory, "maven-resources-filtering.txt"), null );
+
+        Properties result = PropertyUtils
+            .loadPropertyFile( new File( outputDirectory, "maven-resources-filtering.txt" ), null );
         assertFalse( result.isEmpty() );
         assertEquals( mavenProject.getName(), result.get( "pomName" ) );
     }
-    
+
     public void testNoFiltering()
         throws Exception
     {
@@ -183,12 +229,12 @@ public class DefaultMavenResourcesFilteringTest
             .getName() );
 
         String unitFilesDir = getBasedir() + "/src/test/units-files/maven-resources-filtering";
-        File initialImageFile = new File(unitFilesDir, "happy_duke.gif");
-        
+        File initialImageFile = new File( unitFilesDir, "happy_duke.gif" );
+
         Resource resource = new Resource();
         List resources = new ArrayList();
         resources.add( resource );
-        
+
         resource.setDirectory( unitFilesDir );
         resource.setFiltering( false );
         mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, null, null,
@@ -207,10 +253,10 @@ public class DefaultMavenResourcesFilteringTest
         assertEquals( "${foo}", result.get( "foo" ) );
         assertEquals( "@@", result.getProperty( "emptyexpression" ) );
         assertEquals( "${}", result.getProperty( "emptyexpression2" ) );
-        File imageFile = new File(outputDirectory, "happy_duke.gif");
-        assertTrue(filesAreIdentical( initialImageFile, imageFile ));
-    }  
-    
+        File imageFile = new File( outputDirectory, "happy_duke.gif" );
+        assertTrue( filesAreIdentical( initialImageFile, imageFile ) );
+    }
+
     public static boolean filesAreIdentical( File expected, File current )
         throws IOException
     {
@@ -223,15 +269,15 @@ public class DefaultMavenResourcesFilteringTest
         try
         {
             byte[] expectedBuffer = IOUtil.toByteArray( expectedIn );
-            
+
             byte[] currentBuffer = IOUtil.toByteArray( currentIn );
-            if (expectedBuffer.length != currentBuffer.length)
+            if ( expectedBuffer.length != currentBuffer.length )
             {
                 return false;
             }
-            for (int i = 0,size = expectedBuffer.length;i<size;i++)
+            for ( int i = 0, size = expectedBuffer.length; i < size; i++ )
             {
-                if(expectedBuffer[i]!= currentBuffer[i])
+                if ( expectedBuffer[i] != currentBuffer[i] )
                 {
                     return false;
                 }
@@ -245,5 +291,4 @@ public class DefaultMavenResourcesFilteringTest
         return true;
     }
 
-
 }


[maven-filtering] 08/44: remove french character

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 8e289c9e7840aa6d1b9f243ec569d296d3c9d9c9
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Feb 4 21:24:15 2008 +0000

    remove french character
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@618444 13f79535-47bb-0310-9956-ffa450edef68
---
 src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java b/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java
index 70d3fe0..2a75b98 100755
--- a/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/PropertyUtilsTest.java
@@ -26,7 +26,7 @@ import org.codehaus.plexus.PlexusTestCase;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
- * @since 4 f�vr. 08
+ * @since 4 feb 08
  * @version $Id$
  */
 public class PropertyUtilsTest


[maven-filtering] 42/44: remove unused repository

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit dba4186a2bf74d32f84155e15a4f2130dc4c9f34
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Tue Jul 29 21:41:20 2008 +0000

    remove unused repository
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@680854 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/pom.xml b/pom.xml
index 793b3f3..1229e9e 100755
--- a/pom.xml
+++ b/pom.xml
@@ -82,20 +82,5 @@
       <version>1.2</version>
     </dependency>
   </dependencies>
-
-  <!-- remove when plexus-interpolation 1.2 is released -->
-  <repositories>
-    <repository>
-      <id>snapshots.codehaus.org</id>
-      <name>Codehaus Snapshot Development Repository</name>
-      <url>http://snapshots.repository.codehaus.org/</url>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
   
 </project>


[maven-filtering] 26/44: fix documentation add missing mavenSession parameter

Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-filtering-1.0-alpha-1
in repository https://gitbox.apache.org/repos/asf/maven-filtering.git

commit 983c91165574f0d88bdefffc9b77b0c1b271cb75
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Feb 25 22:02:17 2008 +0000

    fix documentation add missing mavenSession parameter
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/sandbox/trunk/shared/maven-filtering@631016 13f79535-47bb-0310-9956-ffa450edef68
---
 src/site/apt/usage.apt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/site/apt/usage.apt b/src/site/apt/usage.apt
index 142c364..3c28ce5 100755
--- a/src/site/apt/usage.apt
+++ b/src/site/apt/usage.apt
@@ -47,7 +47,7 @@ encoding can be null platform default will be used
 
 nonFilteredFileExtensions : is a List of String which file extensions to not apply filtering (default List contains jpg,jpeg,gif,bmp,png)
 
-mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, encoding, filtersFile, nonFilteredFileExtensions );
+mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, encoding, filtersFile, nonFilteredFileExtensions, mavenSession );
 
 +-----+