You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2009/07/28 01:19:56 UTC
svn commit: r798328 - in /maven/plugins/trunk/maven-changes-plugin: pom.xml
src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
Author: olamy
Date: Mon Jul 27 23:19:56 2009
New Revision: 798328
URL: http://svn.apache.org/viewvc?rev=798328&view=rev
Log:
[MCHANGES-161] use new maven-filtering version and don't modify project.properties.
null
Modified:
maven/plugins/trunk/maven-changes-plugin/pom.xml
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
Modified: maven/plugins/trunk/maven-changes-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/pom.xml?rev=798328&r1=798327&r2=798328&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-changes-plugin/pom.xml Mon Jul 27 23:19:56 2009
@@ -243,7 +243,7 @@
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
- <version>1.0-beta-2</version>
+ <version>1.0-beta-3-SNAPSHOT</version>
</dependency>
<!-- schema validation dependencies : jaxp 1.3 is not included with jdk 1.4 (start with 1.5) -->
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java?rev=798328&r1=798327&r2=798328&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java Mon Jul 27 23:19:56 2009
@@ -24,17 +24,25 @@
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Properties;
import java.util.ResourceBundle;
import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.MavenReportException;
import org.apache.maven.shared.filtering.MavenFileFilter;
+import org.apache.maven.shared.filtering.MavenFileFilterRequest;
import org.apache.maven.shared.filtering.MavenFilteringException;
import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
/**
* Goal which creates a nicely formatted Changes Report in html format from a changes.xml file.
@@ -142,8 +150,7 @@
/**
*
- * Format to use for publishDate
- * The value will be available with the following expression ${publishDate}
+ * Format to use for publishDate. The value will be available with the following expression ${publishDate}
*
* @see SimpleDateFormat
*
@@ -214,15 +221,22 @@
{
outputDirectory.mkdirs();
}
+ XmlStreamReader xmlStreamReader = null;
try
{
// so we get encoding from the file itself
- String encoding = ReaderFactory.newXmlReader( xmlPath ).getEncoding();
+ xmlStreamReader = ReaderFactory.newXmlReader( xmlPath );
+ String encoding = xmlStreamReader.getEncoding();
File resultFile = new File( outputDirectory, "changes.xml" );
Date now = new Date();
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat( publishDateFormat, new Locale( publishDateLocale ) );
- project.getProperties().put( "publishDate", simpleDateFormat.format( now ) );
- mavenFileFilter.copyFile( xmlPath, resultFile, true, project, new ArrayList(), false, encoding, session );
+ SimpleDateFormat simpleDateFormat =
+ new SimpleDateFormat( publishDateFormat, new Locale( publishDateLocale ) );
+ Properties additionnalProperties = new Properties();
+ additionnalProperties.put( "publishDate", simpleDateFormat.format( now ) );
+ MavenFileFilterRequest mavenFileFilterRequest =
+ new MavenFileFilterRequest( xmlPath, resultFile, true, project, Collections.EMPTY_LIST, false,
+ encoding, session, additionnalProperties );
+ mavenFileFilter.copyFile( mavenFileFilterRequest );
xmlPath = resultFile;
}
catch ( IOException e )
@@ -233,6 +247,13 @@
{
throw new MavenReportException( "Exception during filtering changes file : " + e.getMessage(), e );
}
+ finally
+ {
+ if ( xmlStreamReader != null )
+ {
+ IOUtil.close( xmlStreamReader );
+ }
+ }
}