Author: brett Date: Sun Apr 2 17:41:47 2006 New Revision: 390930 URL: http://svn.apache.org/viewcvs?rev=390930&view=rev Log: [MJXR-3] include current year in copyright, consistent with Javadoc
Modified: maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java Modified: maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java?rev=390930&r1=390929&r2=390930&view=diff ============================================================================== --- maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java (original) +++ maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java Sun Apr 2 17:41:47 2006 @@ -24,11 +24,13 @@ import org.apache.maven.reporting.AbstractMavenReport; import org.apache.maven.reporting.MavenReportException; import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.StringUtils; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.ArrayList; +import java.util.Calendar; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -95,7 +97,7 @@ /** * String uses at the bottom of the Xref HTML files. * - * @parameter expression="Copyright © ${project.inceptionYear} ${project.organization.name}. All Rights Reserved." + * @parameter expression="${bottom}" default-value="Copyright © {inceptionYear}-{currentYear} ${project.organization.name}. All Rights Reserved." */ private String bottom; @@ -221,10 +223,31 @@ jxr.setRevision( "HEAD" ); jxr.setJavadocLinkDir( getJavadocLocation() ); - jxr.xref( sourceDirs, templateDir, windowTitle, docTitle, bottom ); + jxr.xref( sourceDirs, templateDir, windowTitle, docTitle, getBottomText( project.getInceptionYear() ) ); // and finally copy the stylesheet copyRequiredResources( destinationDirectory ); + } + + private String getBottomText( String inceptionYear ) + { + int actualYear = Calendar.getInstance().get( Calendar.YEAR ); + String year = String.valueOf( actualYear ); + + String bottom = StringUtils.replace( this.bottom, "{currentYear}", year ); + + if ( inceptionYear != null ) + { + if ( inceptionYear.equals( year ) ) + { + bottom = StringUtils.replace( bottom, "{inceptionYear}-", "" ); + } + else + { + bottom = StringUtils.replace( bottom, "{inceptionYear}", inceptionYear ); + } + } + return bottom; } /**