Author: bimargulies
Date: Sun Apr 22 14:09:45 2012
New Revision: 1328886
URL: http://svn.apache.org/viewvc?rev=1328886&view=rev
Log:
[MCHANGES-76]: Add an option to hava an aggregated Changes Report
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/pom.xml
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/src/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/src/changes/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/src/changes/changes.xml
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module2/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module2/pom.xml
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/pom.xml
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/src/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/src/changes/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/src/changes/changes.xml
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/pom.xml
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/src/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/src/changes/
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/src/changes/changes.xml
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/verify.groovy
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesMojo.java
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ReleaseUtils.java
maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/pom.xml?rev=1328886&view=auto
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/pom.xml
(added)
+++
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/pom.xml
Sun Apr 22 14:09:45 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin-test</artifactId>
+ <version>99.0</version>
+ </parent>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin-test1</artifactId>
+ <version>99.0</version>
+ <name>Module1</name>
+ <packaging>jar</packaging>
+ <description>Test report 1.</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/src/changes/changes.xml?rev=1328886&view=auto
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/src/changes/changes.xml
(added)
+++
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module1/src/changes/changes.xml
Sun Apr 22 14:09:45 2012
@@ -0,0 +1,40 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document xmlns="http://maven.apache.org/changes/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0
http://maven.apache.org/xsd/changes-1.0.0.xsd">
+ <properties>
+ <title>Changes report Project</title>
+ <author email="[email protected]">Mr Zloug</author>
+ </properties>
+ <body>
+ <release version="1.1" date="2005-03-01" description="Subsequent release">
+ <action dev="jruiz" type="remove">
+ The element type " link " must be terminated by the matching end-tag.
+ Deleted the erroneous code.
+ <fixes issue="MCHANGES-1"/>
+ <fixes issue="JIRA-12"/>
+ <dueto name="John Doe" email="[email protected]"/>
+ <dueto name="Jane Doe"/>
+ </action>
+ </release>
+ </body>
+</document>
+
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module2/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module2/pom.xml?rev=1328886&view=auto
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module2/pom.xml
(added)
+++
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module2/pom.xml
Sun Apr 22 14:09:45 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin-test</artifactId>
+ <version>99.0</version>
+ </parent>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin-test2</artifactId>
+ <version>99.0</version>
+ <name>Module2</name>
+ <packaging>jar</packaging>
+ <description>Test report 2.</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/pom.xml?rev=1328886&view=auto
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/pom.xml
(added)
+++
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/pom.xml
Sun Apr 22 14:09:45 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin-test</artifactId>
+ <version>99.0</version>
+ </parent>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin-test3</artifactId>
+ <version>99.0</version>
+ <name>Module3</name>
+ <packaging>jar</packaging>
+ <description>Test report 3.</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/src/changes/changes.xml?rev=1328886&view=auto
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/src/changes/changes.xml
(added)
+++
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/module3/src/changes/changes.xml
Sun Apr 22 14:09:45 2012
@@ -0,0 +1,42 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document xmlns="http://maven.apache.org/changes/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0
http://maven.apache.org/xsd/changes-1.0.0.xsd">
+ <properties>
+ <title>Changes report Project</title>
+ <author email="[email protected]">Mr Zloug</author>
+ </properties>
+ <body>
+ <release version="1.1" date="2005-03-01" description="Subsequent release">
+ <action dev="you" type="update" system="bugzilla">
+ Handle different issue systems.
+ <fixes issue="bug-12345"/>
+ <dueto name="John Doe" email="[email protected]"/>
+ </action>
+ <action dev="him" type="update">
+ Updated dependencies.
+ <dueto name="John Doe" email="[email protected]"/>
+ <dueto name="Jane Doe"/>
+ </action>
+ </release>
+ </body>
+</document>
+
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/pom.xml?rev=1328886&view=auto
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/pom.xml
(added)
+++
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/pom.xml
Sun Apr 22 14:09:45 2012
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin-test</artifactId>
+ <version>99.0</version>
+ <name>Maven</name>
+ <packaging>pom</packaging>
+ <description>Test report.</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <issueManagement>
+ <system>jira</system>
+ <url>http://localhost/bla</url>
+ </issueManagement>
+ <properties>
+ <changesPluginVersion>@pom.version@</changesPluginVersion>
+ </properties>
+ <modules>
+ <module>module1</module>
+ <module>module2</module>
+ <module>module3</module>
+ </modules>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>${changesPluginVersion}</version>
+ <configuration>
+ <issueLinkTemplatePerSystem>
+ <jira>http://myjira/browse/%ISSUE%</jira>
+ </issueLinkTemplatePerSystem>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>${changesPluginVersion}</version>
+ <executions>
+ <execution>
+ <id>validate-changes</id>
+ <phase>pre-site</phase>
+ <goals>
+ <goal>changes-validate</goal>
+ </goals>
+ <configuration>
+ <failOnError>true</failOnError>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>@sitePluginVersion@</version>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <excludeDefaults>true</excludeDefaults>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>@pom.version@</version>
+ <configuration>
+ <aggregated>true</aggregated>
+ <issueLinkTemplatePerSystem>
+ <jira>http://myjira/browse/%ISSUE%</jira>
+ </issueLinkTemplatePerSystem>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>changes-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/src/changes/changes.xml?rev=1328886&view=auto
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/src/changes/changes.xml
(added)
+++
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/src/changes/changes.xml
Sun Apr 22 14:09:45 2012
@@ -0,0 +1,51 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<document xmlns="http://maven.apache.org/changes/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0
http://maven.apache.org/xsd/changes-1.0.0.xsd">
+ <properties>
+ <title>Changes report Project</title>
+ <author email="[email protected]">Mr Zloug</author>
+ </properties>
+ <body>
+ <release version="1.1" date="2005-03-01" description="Subsequent release">
+ <action dev="me" type="add">
+ Added additional documentation on how to configure the plugin.
+ </action>
+ <action dev="me" type="fix" issue="MCHANGES-88">
+ Enable retrieving component-specific issues.
+ </action>
+ </release>
+
+ <release version="1.0" date="2005-01-01" description="First release">
+ <action dev="me" type="update" issue="MCHANGES-47" due-to="others"
due-to-email="[email protected]">
+ Uploaded documentation on how to use the plugin.
+ <fixes issue="MCHANGES-88"/>
+ <fixes issue="JIRA-YYY"/>
+ <dueto name="John Doe" email="[email protected]"/>
+ <dueto name="Jane Doe"/>
+ </action>
+ </release>
+
+ <release version="0.1" date="2004-01-01" description="Pre release">
+ </release>
+ </body>
+</document>
+
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/verify.groovy
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/verify.groovy?rev=1328886&view=auto
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/verify.groovy
(added)
+++
maven/plugins/trunk/maven-changes-plugin/src/it/report-aggregated-changes-generation/verify.groovy
Sun Apr 22 14:09:45 2012
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+assert new File(basedir, 'target/site/changes-report.html').exists();
+content = new File(basedir, 'target/site/changes-report.html').text;
+
+assert content.contains( 'Changes Report' );
+
+assert content.contains( '<th>Module1</th>' );
+assert !content.contains( '<th>Module2</th>' );
+assert content.contains( '<th>Module3</th>' );
+assert !content.contains( '<th>Module4</th>' );
+
+assert content.contains( 'MCHANGES-88' );
+assert content.contains( 'MCHANGES-1' );
+assert content.contains( 'bug-12345' );
+
+assert content.contains( 'No changes in this release' );
+
+return true;
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=1328886&r1=1328885&r2=1328886&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
Sun Apr 22 14:09:45 2012
@@ -26,6 +26,7 @@ import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
@@ -33,6 +34,7 @@ import java.util.ResourceBundle;
import org.apache.commons.collections.map.CaseInsensitiveMap;
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;
@@ -55,6 +57,15 @@ public class ChangesMojo
extends AbstractChangesReport
{
/**
+ * A flag whether the report should also include changes from child
modules. If set to <code>false</code>, only
+ * the changes from current project will be written to the report.
+ *
+ * @parameter default-value="false"
+ * @since 2.5
+ */
+ private boolean aggregated;
+
+ /**
* A flag whether the report should also include the dates of individual
actions. If set to <code>false</code>, only
* the dates of releases will be written to the report.
*
@@ -150,7 +161,7 @@ public class ChangesMojo
/**
* Format to use for publishDate. The value will be available with the
following expression ${publishDate}
*
- * @see SimpleDateFormat
+ * @see java.text.SimpleDateFormat
* @parameter default-value="yyyy-MM-dd"
* @since 2.2
*/
@@ -159,7 +170,7 @@ public class ChangesMojo
/**
* Locale to use for publishDate when formatting
*
- * @see Locale
+ * @see java.util.Locale
* @parameter default-value="en"
* @since 2.2
*/
@@ -202,6 +213,8 @@ public class ChangesMojo
*/
private File xmlPath;
+ private ReleaseUtils releaseUtils = new ReleaseUtils( getLog() );
+
private CaseInsensitiveMap caseInsensitiveIssueLinkTemplatePerSystem;
/* --------------------------------------------------------------------- */
@@ -216,55 +229,40 @@ public class ChangesMojo
public void executeReport( Locale locale )
throws MavenReportException
{
+ Date now = new Date();
+ SimpleDateFormat simpleDateFormat =
+ new SimpleDateFormat(publishDateFormat, new
Locale(publishDateLocale));
+ Properties additionalProperties = new Properties();
+ additionalProperties.put("publishDate", simpleDateFormat.format(now));
- if ( !xmlPath.exists() )
- {
- getLog().warn( "changes.xml file " + xmlPath.getAbsolutePath() + "
does not exist." );
- return;
- }
- if ( filteringChanges )
+ ChangesXML changesXml = getChangesFromFile( xmlPath, project,
additionalProperties);
+ if ( changesXml == null ) return;
+
+ if ( aggregated )
{
- if ( !filteredOutputDirectory.exists() )
+ final String basePath = project.getBasedir().getAbsolutePath();
+ final String absolutePath = xmlPath.getAbsolutePath();
+ if ( !absolutePath.startsWith( basePath ) )
{
- filteredOutputDirectory.mkdirs();
- }
- XmlStreamReader xmlStreamReader = null;
- try
- {
- // so we get encoding from the file itself
- xmlStreamReader = ReaderFactory.newXmlReader( xmlPath );
- String encoding = xmlStreamReader.getEncoding();
- File resultFile = new File( filteredOutputDirectory,
"changes.xml" );
- Date now = new Date();
- SimpleDateFormat simpleDateFormat =
- new SimpleDateFormat( publishDateFormat, new Locale(
publishDateLocale ) );
- Properties additionalProperties = new Properties();
- additionalProperties.put( "publishDate",
simpleDateFormat.format( now ) );
- MavenFileFilterRequest mavenFileFilterRequest =
- new MavenFileFilterRequest( xmlPath, resultFile, true,
project, Collections.EMPTY_LIST, false,
- encoding, session,
additionalProperties );
- mavenFileFilter.copyFile( mavenFileFilterRequest );
- xmlPath = resultFile;
+ getLog().warn( "xmlPath should be within the project dir for
aggregated changes report." );
+ return;
}
- catch ( IOException e )
- {
- throw new MavenReportException( "Exception during filtering
changes file : " + e.getMessage(), e );
- }
- catch ( MavenFilteringException e )
- {
- throw new MavenReportException( "Exception during filtering
changes file : " + e.getMessage(), e );
- }
- finally
+ final String relativePath = absolutePath.substring(
basePath.length() );
+
+ List releaseList = changesXml.getReleaseList();
+ for ( Iterator iterator =
project.getCollectedProjects().iterator(); iterator.hasNext(); )
{
- if ( xmlStreamReader != null )
+ final MavenProject childProject = (MavenProject)
iterator.next();
+ final File changesFile = new File( childProject.getBasedir(),
relativePath );
+ final ChangesXML childXml = getChangesFromFile( changesFile,
childProject, additionalProperties );
+ if ( childXml != null )
{
- IOUtil.close( xmlStreamReader );
+ releaseList = releaseUtils.mergeReleases( releaseList,
childProject.getName(), childXml.getReleaseList() );
}
}
-
+ changesXml.setReleaseList( releaseList );
}
- ChangesXML changesXml = new ChangesXML( xmlPath, getLog() );
ChangesReportGenerator report = new ChangesReportGenerator(
changesXml.getReleaseList() );
report.setAuthor( changesXml.getAuthor() );
@@ -346,6 +344,65 @@ public class ChangesMojo
/* --------------------------------------------------------------------- */
/**
+ * Parses specified changes.xml file. It also makes filtering if needed.
If specified file doesn't exist
+ * it will log warning and return <code>null</code>.
+ *
+ * @param changesXml changes xml file to parse
+ * @param project maven project to parse changes for
+ * @param additionalProperties additional properties used for filtering
+ * @return parsed <code>ChangesXML</code> instance or null if file doesn't
exist
+ * @throws MavenReportException if any errors occurs while parsing
+ */
+ private ChangesXML getChangesFromFile( File changesXml, MavenProject
project, Properties additionalProperties )
+ throws MavenReportException
+ {
+ if ( !changesXml.exists() )
+ {
+ getLog().warn( "changes.xml file " + changesXml.getAbsolutePath()
+ " does not exist." );
+ return null;
+ }
+
+ if ( filteringChanges )
+ {
+ if ( !filteredOutputDirectory.exists() )
+ {
+ filteredOutputDirectory.mkdirs();
+ }
+ XmlStreamReader xmlStreamReader = null;
+ try
+ {
+ // so we get encoding from the file itself
+ xmlStreamReader = ReaderFactory.newXmlReader( changesXml );
+ String encoding = xmlStreamReader.getEncoding();
+ File resultFile = new File( filteredOutputDirectory,
project.getGroupId() + "." + project.getArtifactId() + "-changes.xml" );
+
+ final MavenFileFilterRequest mavenFileFilterRequest =
+ new MavenFileFilterRequest( changesXml, resultFile,
true, project, Collections.EMPTY_LIST, false,
+ encoding, session, additionalProperties );
+ mavenFileFilter.copyFile( mavenFileFilterRequest );
+ changesXml = resultFile;
+ }
+ catch ( IOException e )
+ {
+ throw new MavenReportException( "Exception during filtering
changes file : " + e.getMessage(), e );
+ }
+ catch ( MavenFilteringException e )
+ {
+ throw new MavenReportException( "Exception during filtering
changes file : " + e.getMessage(), e );
+ }
+ finally
+ {
+ if ( xmlStreamReader != null )
+ {
+ IOUtil.close( xmlStreamReader );
+ }
+ }
+
+ }
+ return new ChangesXML( changesXml, getLog() );
+ }
+
+ /**
* Add the issue link template for the given issue management system,
* but only if it has not already been configured.
*
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java?rev=1328886&r1=1328885&r2=1328886&view=diff
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
(original)
+++
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesReportGenerator.java
Sun Apr 22 14:09:45 2012
@@ -31,6 +31,7 @@ import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.util.HtmlTools;
import org.apache.maven.plugin.issues.AbstractIssuesReportGenerator;
import org.apache.maven.plugins.changes.model.Action;
+import org.apache.maven.plugins.changes.model.Component;
import org.apache.maven.plugins.changes.model.DueTo;
import org.apache.maven.plugins.changes.model.FixedIssue;
import org.apache.maven.plugins.changes.model.Release;
@@ -211,114 +212,87 @@ public class ChangesReportGenerator exte
{
sinkBeginReport( sink, bundle );
- constructReleaseHistory( sink, bundle, releaseList );
+ constructReleaseHistory(sink, bundle, releaseList);
- constructReleases( sink, bundle, releaseList );
+ constructReleases(sink, bundle, releaseList);
sinkEndReport( sink );
}
- private void constructActions( Sink sink, List actionList, ResourceBundle
bundle )
+ /**
+ * Constructs table row for specified action with all calculated content
(e.g. issue link).
+ *
+ * @param sink Sink
+ * @param bundle Resource bundle
+ * @param action Action to generate content for
+ */
+ private void constructAction( Sink sink, ResourceBundle bundle, Action
action )
{
- if ( actionList.isEmpty() )
- {
- sink.paragraph();
+ sink.tableRow();
- sink.text( bundle.getString( "report.changes.text.no.changes" ) );
+ sinkShowTypeIcon(sink, action.getType());
- sink.paragraph_();
+ sink.tableCell();
+
+ if ( escapeHTML )
+ {
+ sink.text( action.getAction() );
}
else
{
- sink.table();
-
- sink.tableRow();
-
- sinkHeader( sink, bundle.getString( "report.issues.label.type" ) );
-
- sinkHeader( sink, bundle.getString( "report.issues.label.summary"
) );
+ sink.rawText( action.getAction() );
+ }
- sinkHeader( sink, bundle.getString( "report.issues.label.assignee"
) );
+ // no null check needed classes from modello return a new ArrayList
+ if ( StringUtils.isNotEmpty( action.getIssue() ) || (
!action.getFixedIssues().isEmpty() ) )
+ {
+ sink.text( " " + bundle.getString( "report.changes.text.fixes" ) +
" " );
- if ( this.isAddActionDate() )
+ // Try to get the issue management system specified in the
changes.xml file
+ String system = action.getSystem();
+ // Try to get the issue management system configured in the POM
+ if ( StringUtils.isEmpty( system ) )
{
- sinkHeader( sink, bundle.getString(
"report.issues.label.updated" ) );
+ system = this.system;
}
- sink.tableRow_();
-
- for ( int idx = 0; idx < actionList.size(); idx++ )
+ // Use the default issue management system
+ if ( StringUtils.isEmpty( system ) )
{
- Action action = (Action) actionList.get( idx );
-
- sink.tableRow();
+ system = DEFAULT_ISSUE_SYSTEM_KEY;
+ }
+ if ( !canGenerateIssueLinks( system ) )
+ {
+ constructIssueText( action.getIssue(), sink,
action.getFixedIssues() );
+ }
+ else
+ {
+ constructIssueLink( action.getIssue(), system, sink,
action.getFixedIssues() );
+ }
+ sink.text( "." );
+ }
- sinkShowTypeIcon( sink, action.getType() );
+ if ( StringUtils.isNotEmpty( action.getDueTo() ) || (
!action.getDueTos().isEmpty() ) )
+ {
+ constructDueTo( sink, action, bundle, action.getDueTos() );
+ }
- sink.tableCell();
-
- if ( escapeHTML )
- {
- sink.text( action.getAction() );
- }
- else
- {
- sink.rawText( action.getAction() );
- }
-
- // no null check needed classes from modello return a new
ArrayList
- if ( StringUtils.isNotEmpty( action.getIssue() ) || (
!action.getFixedIssues().isEmpty() ) )
- {
- sink.text( " " + bundle.getString(
"report.changes.text.fixes" ) + " " );
-
- // Try to get the issue management system specified in the
changes.xml file
- String system = action.getSystem();
- // Try to get the issue management system configured in
the POM
- if ( StringUtils.isEmpty( system ) )
- {
- system = this.system;
- }
- // Use the default issue management system
- if ( StringUtils.isEmpty( system ) )
- {
- system = DEFAULT_ISSUE_SYSTEM_KEY;
- }
- if ( !canGenerateIssueLinks( system ) )
- {
- constructIssueText( action.getIssue(), sink,
action.getFixedIssues() );
- }
- else
- {
- constructIssueLink( action.getIssue(), system, sink,
action.getFixedIssues() );
- }
- sink.text( "." );
- }
-
- if ( StringUtils.isNotEmpty( action.getDueTo() ) || (
!action.getDueTos().isEmpty() ) )
- {
- constructDueTo( sink, action, bundle, action.getDueTos() );
- }
-
- sink.tableCell_();
-
- if ( NO_TEAMLIST.equals( teamlist ) )
- {
- sinkCell( sink, action.getDev() );
- }
- else
- {
- sinkCellLink( sink, action.getDev(), teamlist + "#" +
action.getDev() );
- }
-
- if ( this.isAddActionDate() )
- {
- sinkCell( sink, action.getDate() );
- }
+ sink.tableCell_();
- sink.tableRow_();
- }
+ if ( NO_TEAMLIST.equals( teamlist ) )
+ {
+ sinkCell( sink, action.getDev() );
+ }
+ else
+ {
+ sinkCellLink( sink, action.getDev(), teamlist + "#" +
action.getDev() );
+ }
- sink.table_();
+ if ( this.isAddActionDate() )
+ {
+ sinkCell( sink, action.getDate() );
}
+
+ sink.tableRow_();
}
/**
@@ -338,7 +312,7 @@ public class ChangesReportGenerator exte
// Only add the dueTo specified as attributes, if it has either a
dueTo or a dueToEmail
if ( StringUtils.isNotEmpty( action.getDueTo() ) ||
StringUtils.isNotEmpty( action.getDueToEmail() ) )
{
- namesEmailMap.put( action.getDueTo(), action.getDueToEmail() );
+ namesEmailMap.put(action.getDueTo(), action.getDueToEmail());
}
for ( Iterator iterator = dueTos.iterator(); iterator.hasNext(); )
@@ -374,7 +348,7 @@ public class ChangesReportGenerator exte
}
}
- sink.text( "." );
+ sink.text(".");
}
/**
@@ -433,7 +407,7 @@ public class ChangesReportGenerator exte
{
if ( StringUtils.isNotEmpty( issue ) )
{
- sink.text( issue );
+ sink.text(issue);
if ( !fixes.isEmpty() )
{
@@ -448,7 +422,7 @@ public class ChangesReportGenerator exte
String currentIssueId = fixedIssue.getIssue();
if ( StringUtils.isNotEmpty( currentIssueId ) )
{
- sink.text( currentIssueId );
+ sink.text(currentIssueId);
}
if ( iterator.hasNext() )
@@ -506,27 +480,141 @@ public class ChangesReportGenerator exte
sink.section2_();
}
+ /**
+ * Constructs document sections for each of specified releases.
+ *
+ * @param sink Sink
+ * @param bundle Resource bundle
+ * @param releaseList Releases to create content for
+ */
private void constructReleases( Sink sink, ResourceBundle bundle, List
releaseList )
{
-
for ( int idx = 0; idx < releaseList.size(); idx++ )
{
- Release release = (Release) releaseList.get( idx );
+ Release release = (Release) releaseList.get(idx);
+ constructRelease( sink, bundle, release );
+ }
+ }
+
+ /**
+ * Constructs document section for specified release.
+ *
+ * @param sink Sink
+ * @param bundle Resource bundle
+ * @param release Release to create document section for
+ */
+ private void constructRelease( Sink sink, ResourceBundle bundle, Release
release )
+ {
+ sink.section2();
+
+ final String date = ( release.getDateRelease() == null ) ? "" : " - "
+ release.getDateRelease();
- sink.section2();
+ sinkSectionTitle2Anchor(sink,
bundle.getString("report.changes.label.release") + " "
+ + release.getVersion() + date, release.getVersion());
- final String date = ( release.getDateRelease() == null ) ? "" : "
- " + release.getDateRelease();
+ if ( isReleaseEmpty( release ) )
+ {
+ sink.paragraph();
+ sink.text( bundle.getString("report.changes.text.no.changes") );
+ sink.paragraph_();
+ }
+ else
+ {
+ sink.table();
- sinkSectionTitle2Anchor( sink, bundle.getString(
"report.changes.label.release" ) + " "
- + release.getVersion() + date, release.getVersion() );
+ sink.tableRow();
+ sinkHeader( sink, bundle.getString( "report.issues.label.type" ) );
+ sinkHeader( sink, bundle.getString( "report.issues.label.summary"
) );
+ sinkHeader(sink, bundle.getString("report.issues.label.assignee"));
+ if ( this.isAddActionDate() )
+ {
+ sinkHeader( sink, bundle.getString(
"report.issues.label.updated" ) );
+ }
+ sink.tableRow_();
- constructActions( sink, release.getActions(), bundle );
+ for (Iterator iterator = release.getActions().iterator();
iterator.hasNext();)
+ {
+ Action action = (Action) iterator.next();
+ constructAction(sink, bundle, action);
+ }
+
+ for (Iterator iterator = release.getComponents().iterator();
iterator.hasNext();)
+ {
+ Component component = (Component) iterator.next();
+ constructComponent( sink, bundle, component );
+ }
+
+ sink.table_();
sink.section2_();
}
}
/**
+ * Constructs table rows for specified release component. It will create
header row for
+ * component name and action rows for all component issues.
+ *
+ * @param sink Sink
+ * @param bundle Resource bundle
+ * @param component Release component to generate content for.
+ */
+ private void constructComponent( Sink sink, ResourceBundle bundle,
Component component )
+ {
+ if ( !component.getActions().isEmpty() )
+ {
+ sink.tableRow();
+
+ sink.tableHeaderCell();
+ sink.tableHeaderCell_();
+
+ sink.tableHeaderCell();
+ sink.text(component.getName());
+ sink.tableHeaderCell_();
+
+ sink.tableHeaderCell();
+ sink.tableHeaderCell_();
+
+ if ( isAddActionDate() )
+ {
+ sink.tableHeaderCell();
+ sink.tableHeaderCell_();
+ }
+
+ sink.tableRow_();
+
+ for ( Iterator iterator = component.getActions().iterator();
iterator.hasNext(); )
+ {
+ Action action = (Action) iterator.next();
+ constructAction( sink, bundle, action );
+ }
+ }
+ }
+
+ /**
+ * Checks if specified release contains own issues or issues inside the
child components.
+ *
+ * @param release Release to check
+ * @return <code>true</code> if release doesn't contain any issues,
<code>false</code> otherwise
+ */
+ private boolean isReleaseEmpty( Release release ) {
+ if ( !release.getActions().isEmpty() )
+ {
+ return false;
+ }
+
+ for (Iterator iterator = release.getComponents().iterator();
iterator.hasNext();)
+ {
+ Component component = (Component) iterator.next();
+ if ( !component.getActions().isEmpty() )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
* Replace tokens in the issue link template with the real values.
*
* @param issue The issue identifier
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ReleaseUtils.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ReleaseUtils.java?rev=1328886&r1=1328885&r2=1328886&view=diff
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ReleaseUtils.java
(original)
+++
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ReleaseUtils.java
Sun Apr 22 14:09:45 2012
@@ -199,4 +199,57 @@ public class ReleaseUtils
}
return releases;
}
+
+ /**
+ * Merge releases from parent component with releases from child component.
+ * If a release is found in both components, i.e. they have the same
version,
+ * their issues are merged into one (parent) release with component marker
+ * for component issues.
+ *
+ * @param releases Releases from the parent component
+ * @param componentName child component name (retrieved from project name)
+ * @param componentReleases Releases from the child component
+ * @return A list containing the merged releases
+ */
+ public List mergeReleases( final List releases, final String
componentName, final List componentReleases ) {
+ if ( releases == null && componentReleases == null )
+ {
+ return Collections.EMPTY_LIST;
+ }
+ if ( componentReleases == null )
+ {
+ return releases;
+ }
+
+ final List mergedReleases = new ArrayList();
+
+ if ( releases != null )
+ {
+ for ( Iterator iterator = releases.iterator(); iterator.hasNext();
)
+ {
+ final Release release = (Release) iterator.next();
+ final Release componentRelease = getRelease(
componentReleases, release.getVersion() );
+ if ( componentRelease != null ) {
+ release.addComponent( componentName, componentRelease );
+ }
+ mergedReleases.add( release );
+ }
+ }
+
+ for ( Iterator iterator = componentReleases.iterator();
iterator.hasNext(); )
+ {
+ final Release release = (Release) iterator.next();
+ final Release mergedRelease = getRelease( mergedReleases,
release.getVersion() );
+ if ( mergedRelease == null )
+ {
+ final Release componentRelease = new Release();
+ componentRelease.setVersion( release.getVersion() );
+ componentRelease.setDateRelease( release.getDateRelease() );
+ componentRelease.addComponent( componentName, release );
+ mergedReleases.add( componentRelease );
+ }
+ }
+
+ return mergedReleases;
+ }
}
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo?rev=1328886&r1=1328885&r2=1328886&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/mdo/changes.mdo Sun Apr
22 14:09:45 2012
@@ -167,6 +167,26 @@ under the License.
}
]]></code>
</codeSegment>
+ <codeSegment>
+ <version>1.0.0</version>
+ <code><![CDATA[
+ private final java.util.List components = new
java.util.ArrayList();
+
+ public void addComponent(String name, Release release)
+ {
+ final Component component = new Component();
+ component.setName(name);
+ component.setDescription(release.getDescription());
+ component.setActions(release.getActions());
+ components.add(component);
+ }
+
+ public java.util.List getComponents()
+ {
+ return components;
+ }
+ ]]></code>
+ </codeSegment>
</codeSegments>
</class>
@@ -195,6 +215,40 @@ under the License.
</field>
</fields>
</class>
+ <class>
+ <name>Component</name>
+ <version>1.0.0</version>
+ <description>
+ A component as a part of current release.
+ </description>
+ <fields>
+ <field>
+ <name>name</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description>
+ The component name.
+ </description>
+ </field>
+ <field>
+ <name>description</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description>
+ The component description.
+ </description>
+ </field>
+ <field>
+ <name>actions</name>
+ <version>1.0.0</version>
+ <association>
+ <type>Action</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <description>The list of actions for this component.</description>
+ </field>
+ </fields>
+ </class>
<class xsd.compositor="sequence">
<name>Action</name>
<version>1.0.0</version>