How do I generate Maven Changelog Plugin reports for a site?
Author: Deron Eriksson
Description: This maven tutorial describes how to generate Maven Changelog Plugin reports for a site.
Tutorial created using: Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1)


Page:    1 2 >

The MavenSW Changelog Plugin can be used to generate useful reports containing information about a project's Software Configuration Management (SCM) status. This plugin will generate 3 types of reports: Change Log, Developer Activity, and File Activity. The Change Log report shows SCM changes that have happened to the project over time (such as the time when files were committed, who committed them, the files that were committed, and the commit comments). This is probably the most useful report, in general. The Developer Activity report offers a developer-centric summary report, and the File Activity report gives a file-centric summary report.

The first thing we need to do to use the Changelog Plugin is to include a reference to the plugin in our project's pom.xml file in the reporting section.

reporting section of pom.xml

	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-changelog-plugin</artifactId>
			</plugin>
		</plugins>
	</reporting>

Since this plugin needs to be able to 'talk' to the SCM repository about the project code in the repository, we need to specify an scm section of the pom.xml file. I'm using CVSNTW on a Windows XP machine on my internal network, so I configured the connection and developerConnection elements. The connection is read only, while the developerConnection has write access. The url element specifies a URL that you can hit to view code in CVSW (you can use tools such as ViewCVS or ViewVC to set up a server to do this).

scm section of pom.xml

	<scm>
		<connection>scm:cvs:pserver:${derbizz.cvs.username}:${derbizz.cvs.password}@192.168.1.10:/cvsrepo:${artifactId}</connection>
		<developerConnection>scm:cvs:pserver:${derbizz.cvs.username}:${derbizz.cvs.password}@192.168.1.10:/cvsrepo:${artifactId}</developerConnection>
		<url>http://192.168.1.10/cvsrepo/${artifactId}</url>
	</scm>

We also need a developers section in pom.xml for the plugin to work ideally, especially for the Developer Activity report.

developers section of pom.xml

	<developers>
		<developer>
			<id>Deron</id>
			<name>Deron Eriksson</name>
			<email>hello@goodbye.com</email>
			<organization>From Beyond</organization>
			<organizationUrl>N/A</organizationUrl>
			<roles>
				<role>lead developer</role>
			</roles>
			<timezone>-8</timezone>
			<url>N/A</url>
		</developer>
	</developers>

I have my site.deployments name and password and my cvsW name and password in my user settings.xml file.

Fragment of user settings.xml

...
	<servers>
		<server>
			<id>site.deployments</id>
			<username>admin</username>
			<password>admin1</password>
		</server>
	</servers>
	<profiles>
		<profile>
			<id>deron.profile</id>
			<properties>
				<derbizz.cvs.username>Deron</derbizz.cvs.username>
				<derbizz.cvs.password></derbizz.cvs.password>
			</properties>
		</profile>
	</profiles>
...
	<activeProfiles>
		<activeProfile>deron.profile</activeProfile>
	</activeProfiles>
...

My complete project pom.xml file is shown here.

pom.xml

<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>com.maventest</groupId>
	<artifactId>aproject</artifactId>
	<packaging>jar</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>aproject</name>
	<url>http://maven.apache.org</url>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<extensions>
			<!-- start - for deploying using webdav -->
			<extension>
				<groupId>org.apache.maven.wagon</groupId>
				<artifactId>wagon-webdav</artifactId>
				<version>1.0-beta-2</version>
			</extension>
			<!-- end - for deploying using webdav -->
		</extensions>
	</build>
	<distributionManagement>
		<!-- start - location where site is deployed - username/password for site.deployments in server.xml -->
		<site>
			<id>site.deployments</id>
			<name>Site deployments</name>
			<url>dav:http://192.168.1.7/sites/${artifactId}/</url>
		</site>
		<!-- end - location where site is deployed - username/password for site.deployments in server.xml -->
	</distributionManagement>
	<developers>
		<developer>
			<id>Deron</id>
			<name>Deron Eriksson</name>
			<email>hello@goodbye.com</email>
			<organization>From Beyond</organization>
			<organizationUrl>N/A</organizationUrl>
			<roles>
				<role>lead developer</role>
			</roles>
			<timezone>-8</timezone>
			<url>N/A</url>
		</developer>
	</developers>
	<scm>
		<connection>scm:cvs:pserver:${derbizz.cvs.username}:${derbizz.cvs.password}@192.168.1.10:/cvsrepo:${artifactId}</connection>
		<developerConnection>scm:cvs:pserver:${derbizz.cvs.username}:${derbizz.cvs.password}@192.168.1.10:/cvsrepo:${artifactId}</developerConnection>
		<url>http://192.168.1.10/cvsrepo/${artifactId}</url>
	</scm>
	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-changelog-plugin</artifactId>
			</plugin>
		</plugins>
	</reporting>
</project>

I can perform a standard "mvn clean site" to generate the report with the rest of the site documentation. Since I'd like to deploy the site to webdav on my ApacheSW server, I'll perform the following to build the site and deploy it:

mvn clean site-deploy

This command generates the following console output:

Console output for 'mvn clean site-deploy' on 'aproject' project

[INFO] Scanning for projects...
WAGON_VERSION: 1.0-beta-2
[INFO] ------------------------------------------------------------------------
[INFO] Building aproject
[INFO]    task-segment: [clean, site-deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\dev\workspace\aproject\target
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [site:site]
[INFO] Generating "Change Log" report.
[INFO] Generating changed sets xml to: C:\dev\workspace\aproject\target\changelog.xml
[INFO] Executing: cvs -z3 -f -d :pserver:Deron@192.168.1.10:/cvsrepo -q log -d "2008-01-23 03:05:45-0800<2008-02-23 03:05:45-0800"
[INFO] Working directory: C:\dev\workspace\aproject
Warning: The server is not supporting gzip-file-contents request, no compression is used.
[INFO] Generating "Developer Activity" report.
[INFO] Using existing changelog.xml...
[INFO] Generating "File Activity" report.
[INFO] Using existing changelog.xml...
[INFO] Generating "Continuous Integration" report.
[INFO] Generating "Dependencies" report.
[INFO] Generating "Issue Tracking" report.
[INFO] Generating "Project License" report.
[INFO] Generating "Mailing Lists" report.
[INFO] Generating "About" report.
[INFO] Generating "Project Summary" report.
[INFO] Generating "Source Repository" report.
[INFO] Generating "Project Team" report.
[INFO] [site:deploy]
http://192.168.1.7/sites/aproject/ - Session: Opened  
Uploading: ./changelog.html to http://192.168.1.7/sites/aproject/

##
Transfer finished. 5598 bytes copied in 0.014 seconds
Uploading: ./css/maven-base.css to http://192.168.1.7/sites/aproject/

#
Transfer finished. 2371 bytes copied in 0.0080 seconds
Uploading: ./css/maven-theme.css to http://192.168.1.7/sites/aproject/

#
Transfer finished. 2801 bytes copied in 0.0090 seconds
Uploading: ./css/print.css to http://192.168.1.7/sites/aproject/

#
Transfer finished. 222 bytes copied in 0.0070 seconds
Uploading: ./css/site.css to http://192.168.1.7/sites/aproject/


Transfer finished. 0 bytes copied in 0.0090 seconds
Uploading: ./dependencies.html to http://192.168.1.7/sites/aproject/

##
Transfer finished. 5420 bytes copied in 0.013 seconds
Uploading: ./dev-activity.html to http://192.168.1.7/sites/aproject/

#
Transfer finished. 3571 bytes copied in 0.0090 seconds
Uploading: ./file-activity.html to http://192.168.1.7/sites/aproject/

##
Transfer finished. 4418 bytes copied in 0.01 seconds
Uploading: ./images/collapsed.gif to http://192.168.1.7/sites/aproject/

#
Transfer finished. 53 bytes copied in 0.0090 seconds
Uploading: ./images/expanded.gif to http://192.168.1.7/sites/aproject/

#
Transfer finished. 52 bytes copied in 0.0080 seconds
Uploading: ./images/external.png to http://192.168.1.7/sites/aproject/

#
Transfer finished. 230 bytes copied in 0.0090 seconds
Uploading: ./images/icon_error_sml.gif to http://192.168.1.7/sites/aproject/

#
Transfer finished. 1010 bytes copied in 0.0090 seconds
Uploading: ./images/icon_info_sml.gif to http://192.168.1.7/sites/aproject/

#
Transfer finished. 606 bytes copied in 0.01 seconds
Uploading: ./images/icon_success_sml.gif to http://192.168.1.7/sites/aproject/

#
Transfer finished. 990 bytes copied in 0.011 seconds
Uploading: ./images/icon_warning_sml.gif to http://192.168.1.7/sites/aproject/

#
Transfer finished. 576 bytes copied in 0.0090 seconds
Uploading: ./images/logos/build-by-maven-black.png to http://192.168.1.7/sites/aproject/

#
Transfer finished. 2294 bytes copied in 0.0090 seconds
Uploading: ./images/logos/build-by-maven-white.png to http://192.168.1.7/sites/aproject/

#
Transfer finished. 2260 bytes copied in 0.0090 seconds
Uploading: ./images/logos/maven-feather.png to http://192.168.1.7/sites/aproject/

#
Transfer finished. 3330 bytes copied in 0.0080 seconds
Uploading: ./images/newwindow.png to http://192.168.1.7/sites/aproject/

#
Transfer finished. 220 bytes copied in 0.0090 seconds
Uploading: ./index.html to http://192.168.1.7/sites/aproject/

#
Transfer finished. 3978 bytes copied in 0.0090 seconds
Uploading: ./integration.html to http://192.168.1.7/sites/aproject/

#
Transfer finished. 4024 bytes copied in 0.012 seconds
Uploading: ./issue-tracking.html to http://192.168.1.7/sites/aproject/

#
Transfer finished. 3988 bytes copied in 0.014 seconds
Uploading: ./license.html to http://192.168.1.7/sites/aproject/

#
Transfer finished. 3971 bytes copied in 0.012 seconds
Uploading: ./mail-lists.html to http://192.168.1.7/sites/aproject/

#
Transfer finished. 3999 bytes copied in 0.012 seconds
Uploading: ./project-info.html to http://192.168.1.7/sites/aproject/

##
Transfer finished. 6016 bytes copied in 0.014 seconds
Uploading: ./project-reports.html to http://192.168.1.7/sites/aproject/

#
Transfer finished. 3888 bytes copied in 0.011 seconds
Uploading: ./project-summary.html to http://192.168.1.7/sites/aproject/

##
Transfer finished. 4797 bytes copied in 0.013 seconds
Uploading: ./source-repository.html to http://192.168.1.7/sites/aproject/

##
Transfer finished. 5435 bytes copied in 0.016 seconds
Uploading: ./team-list.html to http://192.168.1.7/sites/aproject/

##
Transfer finished. 5801 bytes copied in 0.016 seconds
http://192.168.1.7/sites/aproject/ - Session: Disconnecting  
http://192.168.1.7/sites/aproject/ - Session: Disconnected
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10 seconds
[INFO] Finished at: Fri Feb 22 03:05:49 PST 2008
[INFO] Final Memory: 15M/30M
[INFO] ------------------------------------------------------------------------

(Continued on page 2)

Page:    1 2 >


Related Tutorials: