Author: hboutemy
Date: Fri Apr 18 11:53:52 2008
New Revision: 649653

URL: http://svn.apache.org/viewvc?rev=649653&view=rev
Log:
[MRESOURCES-57] use ${project.build.sourceEncoding} as default value for 
"encoding" parameter

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

Modified: 
maven/plugins/trunk/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java?rev=649653&r1=649652&r2=649653&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
 Fri Apr 18 11:53:52 2008
@@ -54,7 +54,7 @@
     /**
      * The character encoding scheme to be applied.
      *
-     * @parameter
+     * @parameter expression="${encoding}" 
default-value="${project.build.sourceEncoding}"
      */
     private String encoding;
 
@@ -95,6 +95,16 @@
      */
     private List filters;
 
+    /**
+     * Gets the source file encoding.
+     *
+     * @return The source file encoding, never <code>null</code>.
+     */
+    protected String getEncoding()
+    {
+        return ( encoding == null ) ? ReaderFactory.ISO_8859_1 : encoding;
+    }
+
     public void execute()
         throws MojoExecutionException
     {
@@ -106,14 +116,7 @@
     {
         initializeFiltering();
 
-        if ( encoding == null || encoding.length() < 1 )
-        {
-            getLog().info( "Using platform encoding (" + 
ReaderFactory.FILE_ENCODING + " actually) to copy filtered resources." );
-        }
-        else
-        {
-            getLog().info( "Using " + encoding + " encoding to copy filtered 
resources." );
-        }
+        getLog().info( "Using " + getEncoding() + " encoding to copy filtered 
resources." );
 
         for ( Iterator i = resources.iterator(); i.hasNext(); )
         {


Reply via email to