You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/04/18 13:59:55 UTC
svn commit: r649475 -
/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
Author: bentmann
Date: Fri Apr 18 04:59:54 2008
New Revision: 649475
URL: http://svn.apache.org/viewvc?rev=649475&view=rev
Log:
[MINVOKER-30] Allow to configure file encoding for verifications scripts
Modified:
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java?rev=649475&r1=649474&r2=649475&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java Fri Apr 18 04:59:54 2008
@@ -289,6 +289,14 @@
*/
private String mavenOpts;
+ /**
+ * The file encoding for the BeanShell scripts and the list files for goals and profiles.
+ *
+ * @parameter expression="${encoding}" default-value="${project.build.sourceEncoding}"
+ * @since 1.2
+ */
+ private String encoding;
+
public void execute()
throws MojoExecutionException, MojoFailureException
{
@@ -396,6 +404,16 @@
}
}
+ /**
+ * 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;
+ }
+
private void cloneProjects( String[] includedPoms )
throws IOException
{
@@ -787,7 +805,7 @@
engine.set( "basedir", basedir );
- reader = ReaderFactory.newPlatformReader( script );
+ reader = ReaderFactory.newReader( script, getEncoding() );
final Object result = engine.eval( reader );
@@ -975,7 +993,7 @@
try
{
Map composite = new CompositeMap( this.project, this.interpolationsProperties );
- reader = new BufferedReader( new InterpolationFilterReader( ReaderFactory.newPlatformReader( projectGoalList ), composite ) );
+ reader = new BufferedReader( new InterpolationFilterReader( ReaderFactory.newReader( projectGoalList, getEncoding() ), composite ) );
result = new ArrayList();
@@ -1093,7 +1111,7 @@
try
{
List profilesInFiles = new ArrayList();
- reader = new BufferedReader( ReaderFactory.newPlatformReader( projectProfilesFile ) );
+ reader = new BufferedReader( ReaderFactory.newReader( projectProfilesFile, getEncoding() ) );
String line = null;
while ( ( line = reader.readLine() ) != null )
{