Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 58430 invoked from network); 4 Oct 2010 22:22:56 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Oct 2010 22:22:56 -0000 Received: (qmail 79960 invoked by uid 500); 4 Oct 2010 22:22:56 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 79821 invoked by uid 500); 4 Oct 2010 22:22:55 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 79814 invoked by uid 99); 4 Oct 2010 22:22:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Oct 2010 22:22:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Oct 2010 22:22:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 413BB23888CE; Mon, 4 Oct 2010 22:22:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1004461 - in /maven/plugins/trunk/maven-antrun-plugin/src: it/task-encoding-test/ it/task-encoding-test/pom.xml main/java/org/apache/maven/plugin/antrun/AntRunMojo.java Date: Mon, 04 Oct 2010 22:22:31 -0000 To: commits@maven.apache.org From: pgier@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101004222231.413BB23888CE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: pgier Date: Mon Oct 4 22:22:30 2010 New Revision: 1004461 URL: http://svn.apache.org/viewvc?rev=1004461&view=rev Log: [MANTRUN-155] Set encoding for generated Ant build. Patch from Anders Hammar with some minor changes. Added: maven/plugins/trunk/maven-antrun-plugin/src/it/task-encoding-test/ maven/plugins/trunk/maven-antrun-plugin/src/it/task-encoding-test/pom.xml (with props) Modified: maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java Added: maven/plugins/trunk/maven-antrun-plugin/src/it/task-encoding-test/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/it/task-encoding-test/pom.xml?rev=1004461&view=auto ============================================================================== --- maven/plugins/trunk/maven-antrun-plugin/src/it/task-encoding-test/pom.xml (added) +++ maven/plugins/trunk/maven-antrun-plugin/src/it/task-encoding-test/pom.xml Mon Oct 4 22:22:30 2010 @@ -0,0 +1,61 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.antrun + mantrun-155 + 1.0-SNAPSHOT + pom + + mantrun-155 + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-antrun-plugin + @pom.version@ + + + antrun + test + + run + + + + + + + + + + + + + Propchange: maven/plugins/trunk/maven-antrun-plugin/src/it/task-encoding-test/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-antrun-plugin/src/it/task-encoding-test/pom.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java?rev=1004461&r1=1004460&r2=1004461&view=diff ============================================================================== --- maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java (original) +++ maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java Mon Oct 4 22:22:30 2010 @@ -82,6 +82,11 @@ public class AntRunMojo public final static String DEFAULT_ANT_TARGET_NAME = "main"; /** + * The default encoding to use for the generated Ant build. + */ + public final static String DEFAULT_ANT_BUILD_ENCODING = "UTF-8"; + + /** * The name used for the ant target */ private String antTargetName; @@ -452,6 +457,12 @@ public class AntRunMojo private File writeTargetToProjectFile() throws IOException, PlexusConfigurationException { + String encoding = project.getProperties().getProperty( "project.build.sourceEncoding" ); + if ( encoding == null ) + { + encoding = DEFAULT_ANT_BUILD_ENCODING; + } + // Have to use an XML writer because in Maven 2.x the PlexusConfig toString() method loses XML attributes StringWriter writer = new StringWriter(); AntrunXmlPlexusConfigurationWriter xmlWriter = new AntrunXmlPlexusConfigurationWriter(); @@ -477,6 +488,8 @@ public class AntRunMojo xmlns = "xmlns:" + customTaskPrefix + "=\"" + TASK_URI + "\""; } + final String xmlHeader = "\n"; + antProjectConfig.insert( 0, xmlHeader ); final String projectOpen = "\n"; int index = antProjectConfig.indexOf( "