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

svn commit: r1729692 - in /maven/plugins/trunk/maven-resources-plugin: pom.xml src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java

Author: khmarbaise
Date: Wed Feb 10 19:22:16 2016
New Revision: 1729692

URL: http://svn.apache.org/viewvc?rev=1729692&view=rev
Log:
[MRESOURCES-213] Moved code into maven-filtering
 o Moved code part into maven-filtering cause it belongs
   to maven filtering.

Modified:
    maven/plugins/trunk/maven-resources-plugin/pom.xml
    maven/plugins/trunk/maven-resources-plugin/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java

Modified: maven/plugins/trunk/maven-resources-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-resources-plugin/pom.xml?rev=1729692&r1=1729691&r2=1729692&view=diff
==============================================================================
--- maven/plugins/trunk/maven-resources-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-resources-plugin/pom.xml Wed Feb 10 19:22:16 2016
@@ -65,7 +65,7 @@ under the License.
   </distributionManagement>
 
   <properties>
-    <mavenFilteringVersion>3.0.0</mavenFilteringVersion>
+    <mavenFilteringVersion>3.1.0-SNAPSHOT</mavenFilteringVersion>
     <mavenVersion>3.0</mavenVersion>
     <!--
       ! Here we start with JDK 6 for release 3.X

Modified: maven/plugins/trunk/maven-resources-plugin/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-resources-plugin/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java?rev=1729692&r1=1729691&r2=1729692&view=diff
==============================================================================
--- maven/plugins/trunk/maven-resources-plugin/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java (original)
+++ maven/plugins/trunk/maven-resources-plugin/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java Wed Feb 10 19:22:16 2016
@@ -19,6 +19,13 @@ package org.apache.maven.plugins.resourc
  * under the License.
  */
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
@@ -40,13 +47,6 @@ import org.codehaus.plexus.personality.p
 import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-
 /**
  * Copy resources for the main source code to the main output directory. Always uses the project.build.resources element
  * to specify the resources to copy.
@@ -193,7 +193,7 @@ public class ResourcesMojo
      * @since 2.4
      */
     @Parameter
-    protected List<String> delimiters;
+    protected LinkedHashSet<String> delimiters;
 
     /**
      * Use default delimiters in addition to custom delimiters, if any.
@@ -242,8 +242,9 @@ public class ResourcesMojo
     private boolean fileNameFiltering;
 
     /**
-     * You can skip the execution of the plugin if you need to.
-     * Its use is NOT RECOMMENDED, but quite convenient on occasion.
+     * You can skip the execution of the plugin if you need to. Its use is NOT RECOMMENDED, but quite convenient on
+     * occasion.
+     * 
      * @since 3.0.0
      */
     @Parameter( property = "maven.resources.skip", defaultValue = "false" )
@@ -264,14 +265,14 @@ public class ResourcesMojo
             return;
         }
 
-        try
+        if ( StringUtils.isEmpty( encoding ) && isFilteringEnabled( getResources() ) )
         {
+            getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+                + ", i.e. build is platform dependent!" );
+        }
 
-            if ( StringUtils.isEmpty( encoding ) && isFilteringEnabled( getResources() ) )
-            {
-                getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
-                    + ", i.e. build is platform dependent!" );
-            }
+        try
+        {
 
             List<String> filters = getCombinedFiltersList();
 
@@ -292,29 +293,7 @@ public class ResourcesMojo
             mavenResourcesExecution.setFilterFilenames( fileNameFiltering );
 
             // if these are NOT set, just use the defaults, which are '${*}' and '@'.
-            if ( delimiters != null && !delimiters.isEmpty() )
-            {
-                LinkedHashSet<String> delims = new LinkedHashSet<String>();
-                if ( useDefaultDelimiters )
-                {
-                    delims.addAll( mavenResourcesExecution.getDelimiters() );
-                }
-
-                for ( String delim : delimiters )
-                {
-                    if ( delim == null )
-                    {
-                        // FIXME: ${filter:*} could also trigger this condition. Need a better long-term solution.
-                        delims.add( "${*}" );
-                    }
-                    else
-                    {
-                        delims.add( delim );
-                    }
-                }
-
-                mavenResourcesExecution.setDelimiters( delims );
-            }
+            mavenResourcesExecution.setDelimiters( delimiters, useDefaultDelimiters );
 
             if ( nonFilteredFileExtensions != null )
             {
@@ -461,12 +440,12 @@ public class ResourcesMojo
         this.filters = filters;
     }
 
-    public List<String> getDelimiters()
+    public LinkedHashSet<String> getDelimiters()
     {
         return delimiters;
     }
 
-    public void setDelimiters( List<String> delimiters )
+    public void setDelimiters( LinkedHashSet<String> delimiters )
     {
         this.delimiters = delimiters;
     }