maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1722626 - in /maven/plugins/trunk/maven-site-plugin/src: it/failure/ main/java/org/apache/maven/plugins/site/ main/java/org/apache/maven/plugins/site/render/ main/java/org/apache/maven/plugins/site/run/
Date Sat, 02 Jan 2016 13:20:24 GMT
Author: hboutemy
Date: Sat Jan  2 13:20:23 2016
New Revision: 1722626

URL: http://svn.apache.org/viewvc?rev=1722626&view=rev
Log:
[MSITE-326] made file encoding default to platform encoding (instead of ISO-8859-1), with
warning (only on site rendering goals)

Modified:
    maven/plugins/trunk/maven-site-plugin/src/it/failure/invoker.properties
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java

Modified: maven/plugins/trunk/maven-site-plugin/src/it/failure/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/failure/invoker.properties?rev=1722626&r1=1722625&r2=1722626&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/failure/invoker.properties (original)
+++ maven/plugins/trunk/maven-site-plugin/src/it/failure/invoker.properties Sat Jan  2 13:20:23
2016
@@ -20,9 +20,9 @@ invoker.debug = false
 
 # --log-file option is only supported by Maven 3
 invoker.maven.version = 3.0+
-invoker.goals.1 = --log-file report-plugin.log -Preport-plugin site
-invoker.goals.2 = --log-file report-plugin-debug.log -Preport-plugin site
+invoker.goals.1 = --log-file report-plugin.log -DsiteOutputDirectory=target/site-report-plugin
-Preport-plugin clean site
+invoker.goals.2 = --log-file report-plugin-debug.log -DsiteOutputDirectory=target/site-report-plugin-debug
-Preport-plugin clean site
 invoker.debug.2 = true
-invoker.goals.3 = --log-file doxia-parse.log -Pdoxia-parse site
-invoker.goals.4 = --log-file doxia-parse-debug.log -Pdoxia-parse site
+invoker.goals.3 = --log-file doxia-parse.log -DsiteOutputDirectory=target/doxia-parse -Pdoxia-parse
clean site
+invoker.goals.4 = --log-file doxia-parse-debug.log -DsiteOutputDirectory=target/doxia-parse-debug
-Pdoxia-parse clean site
 invoker.debug.4 = true

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java?rev=1722626&r1=1722625&r2=1722626&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
(original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
Sat Jan  2 13:20:23 2016
@@ -35,7 +35,6 @@ import org.apache.maven.plugins.annotati
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.i18n.I18N;
 import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.ReaderFactory;
 
 /**
  * Base class for site mojos.
@@ -95,42 +94,6 @@ public abstract class AbstractSiteMojo
     protected List<MavenProject> reactorProjects;
 
     /**
-     * Specifies the input encoding.
-     *
-     * @since 2.3
-     */
-    @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" )
-    private String inputEncoding;
-
-    /**
-     * Specifies the output encoding.
-     *
-     * @since 2.3
-     */
-    @Parameter( property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}"
)
-    private String outputEncoding;
-
-    /**
-     * Gets the input files encoding.
-     *
-     * @return The input files encoding, never <code>null</code>.
-     */
-    protected String getInputEncoding()
-    {
-        return ( inputEncoding == null ) ? ReaderFactory.ISO_8859_1 : inputEncoding;
-    }
-
-    /**
-     * Gets the effective reporting output files encoding.
-     *
-     * @return The effective reporting output file encoding, never <code>null</code>.
-     */
-    protected String getOutputEncoding()
-    {
-        return ( outputEncoding == null ) ? ReaderFactory.UTF_8 : outputEncoding;
-    }
-
-    /**
      * Check the current Maven version to see if it's Maven 3.0 or newer.
      */
     protected static boolean isMaven3OrMore()

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java?rev=1722626&r1=1722625&r2=1722626&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
(original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
Sat Jan  2 13:20:23 2016
@@ -53,12 +53,14 @@ import org.apache.maven.reporting.exec.M
 import org.apache.maven.reporting.exec.MavenReportExecutor;
 import org.apache.maven.reporting.exec.MavenReportExecutorRequest;
 import org.apache.maven.reporting.exec.ReportPlugin;
+import org.apache.maven.shared.utils.StringUtils;
 import org.codehaus.plexus.PlexusConstants;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.context.Context;
 import org.codehaus.plexus.context.ContextException;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+import org.codehaus.plexus.util.ReaderFactory;
 
 /**
  * Base class for site rendering mojos.
@@ -190,6 +192,42 @@ public abstract class AbstractSiteRender
     private boolean generateProjectInfo;
 
     /**
+     * Specifies the input encoding.
+     *
+     * @since 2.3
+     */
+    @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" )
+    private String inputEncoding;
+
+    /**
+     * Specifies the output encoding.
+     *
+     * @since 2.3
+     */
+    @Parameter( property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}"
)
+    private String outputEncoding;
+
+    /**
+     * Gets the input files encoding.
+     *
+     * @return The input files encoding, never <code>null</code>.
+     */
+    protected String getInputEncoding()
+    {
+        return ( StringUtils.isEmpty( inputEncoding ) ) ? ReaderFactory.FILE_ENCODING : inputEncoding;
+    }
+
+    /**
+     * Gets the effective reporting output files encoding.
+     *
+     * @return The effective reporting output file encoding, never <code>null</code>.
+     */
+    protected String getOutputEncoding()
+    {
+        return ( outputEncoding == null ) ? ReaderFactory.UTF_8 : outputEncoding;
+    }
+
+    /**
      * Whether to save Velocity processed Doxia content (<code>*.<ext>.vm</code>)
      * to <code>${generatedSiteDirectory}/processed</code>.
      *
@@ -205,6 +243,15 @@ public abstract class AbstractSiteRender
         container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
     }
 
+    protected void checkInputEncoding()
+    {
+        if ( StringUtils.isEmpty( inputEncoding ) )
+        {
+            getLog().warn( "Input file encoding has not been set, using platform encoding
"
+                + ReaderFactory.FILE_ENCODING + ", i.e. build is platform dependent!" );
+        }
+    }
+
     protected List<MavenReportExecution> getReports()
         throws MojoExecutionException
     {

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java?rev=1722626&r1=1722625&r2=1722626&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java
(original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java
Sat Jan  2 13:20:23 2016
@@ -118,6 +118,8 @@ public class SiteMojo
             getLog().debug( "executing Site Mojo" );
         }
 
+        checkInputEncoding();
+
         List<MavenReportExecution> reports;
         if ( generateReports )
         {

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java?rev=1722626&r1=1722625&r2=1722626&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java
(original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/run/SiteRunMojo.java
Sat Jan  2 13:20:23 2016
@@ -76,6 +76,8 @@ public class SiteRunMojo
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
+        checkInputEncoding();
+
         Server server = new Server();
         server.setStopAtShutdown( true );
 



Mime
View raw message