From 137cb3f9ddf4a5e3091bf9036365d3778ed2616d Mon Sep 17 00:00:00 2001 From: ltheussl Date: Thu, 24 Aug 2006 22:55:52 +0000 Subject: [PATCH] PR: MPCHANGES-32 The encoding of the changes.xml file is not preserved after doing release-version. New property maven.changes.outputencoding. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@434555 13f79535-47bb-0310-9956-ffa450edef68 --- changes/plugin.jelly | 4 ++-- changes/plugin.properties | 3 +++ .../org/apache/maven/changes/ReleaseVersion.java | 13 ++++++++++++- changes/xdocs/changes.xml | 2 ++ changes/xdocs/properties.xml | 12 ++++++++++++ 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/changes/plugin.jelly b/changes/plugin.jelly index 5b9f1302..48a58aa5 100644 --- a/changes/plugin.jelly +++ b/changes/plugin.jelly @@ -112,9 +112,9 @@ - + - + diff --git a/changes/plugin.properties b/changes/plugin.properties index 19ad8a84..604e7a70 100644 --- a/changes/plugin.properties +++ b/changes/plugin.properties @@ -47,3 +47,6 @@ maven.changes.sort = false # Decide the sort order for action types maven.changes.sort.order = add,fix,update,remove + +# To force an encoding for the changes.xml file +# maven.changes.outputencoding = \ No newline at end of file diff --git a/changes/src/main/org/apache/maven/changes/ReleaseVersion.java b/changes/src/main/org/apache/maven/changes/ReleaseVersion.java index 1a1e663a..de9a355d 100644 --- a/changes/src/main/org/apache/maven/changes/ReleaseVersion.java +++ b/changes/src/main/org/apache/maven/changes/ReleaseVersion.java @@ -120,7 +120,18 @@ public class ReleaseVersion format.setIndentSize( 2 ); format.setNewlines( true ); format.setTrimText( true ); - format.setEncoding( encoding ); + if ( encoding == null || "".equals( encoding ) ) + { + String docsEncoding = doc.getXMLEncoding(); + if ( docsEncoding != null ) + { + format.setEncoding( docsEncoding ); + } + } + else + { + format.setEncoding( encoding ); + } XMLWriter writer = new XMLWriter( format ); writer.setOutputStream( os ); diff --git a/changes/xdocs/changes.xml b/changes/xdocs/changes.xml index 1117449b..bb6b60ad 100644 --- a/changes/xdocs/changes.xml +++ b/changes/xdocs/changes.xml @@ -24,6 +24,8 @@ + The encoding of the changes.xml file is not preserved after doing release-version. + New property maven.changes.outputencoding. Update dom4j dependency to match the one in maven 1.1 core. Replace the deprecated xmlParserAPIs by xml-apis 1.3.03. Upgrade to commons-io 1.2. diff --git a/changes/xdocs/properties.xml b/changes/xdocs/properties.xml index 64aa15ab..01523c5c 100644 --- a/changes/xdocs/properties.xml +++ b/changes/xdocs/properties.xml @@ -77,6 +77,18 @@ add,fix,update,remove + + maven.changes.outputencoding + Yes + + Sets the encoding for the changes.xml file when using + the release-version tag. This can be useful to ensure + the same encoding for all files. + + + Default is empty, so the encoding of changes.xml will be preserved. + +