Author: dennisl
Date: Sun Jan 23 18:04:11 2011
New Revision: 1062482
URL: http://svn.apache.org/viewvc?rev=1062482&view=rev
Log:
[MCHANGES-197] Add parameter for output encoding
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractChangesReport.java
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractChangesReport.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractChangesReport.java?rev=1062482&r1=1062481&r2=1062482&view=diff
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractChangesReport.java
(original)
+++
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractChangesReport.java
Sun Jan 23 18:04:11 2011
@@ -19,6 +19,7 @@ package org.apache.maven.plugin.changes;
* under the License.
*/
+import org.apache.commons.lang.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -40,6 +41,7 @@ import org.apache.maven.project.MavenPro
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.i18n.I18N;
+import org.codehaus.plexus.util.ReaderFactory;
import java.io.File;
import java.io.FileWriter;
@@ -71,6 +73,16 @@ public abstract class AbstractChangesRep
private File outputDirectory;
/**
+ * Report output encoding. Note that this parameter is only relevant if
the goal is run from the command line or
+ * from the default build lifecycle. If the goal is run indirectly as part
of a site generation, the output
+ * encoding configured in the Maven Site Plugin is used instead.
+ *
+ * @parameter expression="${outputEncoding}"
default-value="${project.reporting.outputEncoding}"
+ * @since 2.4
+ */
+ private String outputEncoding;
+
+ /**
* Doxia Site Renderer.
*
* @component
@@ -161,10 +173,11 @@ public abstract class AbstractChangesRep
DecorationModel model = new DecorationModel();
model.setBody( new Body() );
Map attributes = new HashMap();
- attributes.put( "outputEncoding", "UTF-8" );
+ attributes.put( "outputEncoding", getOutputEncoding() );
Locale locale = Locale.getDefault();
SiteRenderingContext siteContext =
siteRenderer.createContextForSkin( getSkinArtifactFile(), attributes,
model, getName( locale ), locale );
+ siteContext.setOutputEncoding( getOutputEncoding() );
RenderingContext context = new RenderingContext( outputDirectory,
getOutputName() + ".html" );
@@ -206,6 +219,17 @@ public abstract class AbstractChangesRep
}
/**
+ * Get the effective reporting output file encoding.
+ *
+ * @return The effective reporting output file encoding, never
<code>null</code>.
+ * @since 2.4
+ */
+ protected String getOutputEncoding()
+ {
+ return ( outputEncoding != null ) ? outputEncoding :
ReaderFactory.UTF_8;
+ }
+
+ /**
* @see org.apache.maven.reporting.AbstractMavenReport#getProject()
*/
protected MavenProject getProject()