Author: dennisl Date: Tue Jan 22 15:16:28 2008 New Revision: 614371 URL: http://svn.apache.org/viewvc?rev=614371&view=rev Log: o Rename parameters so that they are in sync with JiraMojo. o Refactor to avoid code duplication.
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java?rev=614371&r1=614370&r2=614371&view=diff ============================================================================== --- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java (original) +++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java Tue Jan 22 15:16:28 2008 @@ -184,7 +184,7 @@ * @required * @readonly */ - private Settings setting; + private Settings settings; /** * Flag to determine if the plugin will generate a JIRA announcement. @@ -196,17 +196,25 @@ /** * Only closed issues are needed. + * <p> + * <b>Note:</b> In versions 2.0-beta-3 and earlier this parameter was + * called "statusId". + * </p> * * @parameter default-value="Closed" */ - private String statusId; + private String statusIds; /** * Only fixed issues are needed. + * <p> + * <b>Note:</b> In versions 2.0-beta-3 and earlier this parameter was + * called "resolutionId". + * </p> * * @parameter default-value="Fixed" */ - private String resolutionId; + private String resolutionIds; /** * The path of the XML file of JIRA-announcements to be parsed. @@ -219,11 +227,15 @@ /** * The maximum number of issues to include. + * <p> + * <b>Note:</b> In versions 2.0-beta-3 and earlier this parameter was + * called "nbEntries". + * </p> * * @parameter default-value="25" * @required */ - private int nbEntries; + private int maxEntries; //=======================================// // announcement-generate execution // @@ -241,7 +253,9 @@ { setXml( new ChangesXML( getXmlPath(), getLog() ) ); - doGenerate( getXml() ); + getLog().info( "Creating announcement file from changes.xml..." ); + + doGenerate( getXml().getReleaseList() ); } else { @@ -252,59 +266,9 @@ /** * Add the parameters to velocity context * - * @param xml parsed changes.xml + * @param releases A <code>List</code> of <code>Release</code>s * @throws MojoExecutionException */ - public void doGenerate( ChangesXML xml ) - throws MojoExecutionException - { - try - { - Context context = new VelocityContext(); - - List releaseList = xml.getReleaseList(); - - getLog().info( "Creating announcement file from changes.xml..." ); - - if ( getIntroduction() == null || getIntroduction().equals( "" ) ) - { - setIntroduction( getUrl() ); - } - - context.put( "releases", releaseList ); - - context.put( "groupId", getGroupId() ); - - context.put( "artifactId", getArtifactId() ); - - context.put( "version", getVersion() ); - - context.put( "packaging", getPackaging() ); - - context.put( "url", getUrl() ); - - context.put( "release", getLatestRelease( releaseList ) ); - - context.put( "introduction", getIntroduction() ); - - context.put( "developmentTeam", getDevelopmentTeam() ); - - context.put( "finalName", getFinalName() ); - - context.put( "urlDownload", getUrlDownload() ); - - processTemplate( context, getOutputDirectory(), template ); - } - catch ( ResourceNotFoundException rnfe ) - { - throw new MojoExecutionException( "resource not found." ); - } - catch ( VelocityException ve ) - { - throw new MojoExecutionException( ve.toString() ); - } - } - public void doGenerate( List releases ) throws MojoExecutionException { @@ -312,8 +276,6 @@ { Context context = new VelocityContext(); - getLog().info( "Creating announcement file from JIRA releases..." ); - if ( getIntroduction() == null || getIntroduction().equals( "" ) ) { setIntroduction( getUrl() ); @@ -345,11 +307,11 @@ } catch ( ResourceNotFoundException rnfe ) { - throw new MojoExecutionException( "resource not found." ); + throw new MojoExecutionException( "Resource not found.", rnfe ); } catch ( VelocityException ve ) { - throw new MojoExecutionException( ve.toString() ); + throw new MojoExecutionException( ve.toString(), ve ); } } @@ -358,6 +320,7 @@ * with the version from the pom. * * @param releases list of releases + * @return A <code>Release</code> that matches the next release of the current project * @throws MojoExecutionException */ public Release getLatestRelease( List releases ) @@ -480,15 +443,15 @@ jiraDownloader.setOutput( jiraXMLFile ); - jiraDownloader.setStatusIds( statusId ); + jiraDownloader.setStatusIds( statusIds ); - jiraDownloader.setResolutionIds( resolutionId ); + jiraDownloader.setResolutionIds( resolutionIds ); jiraDownloader.setMavenProject( project ); - jiraDownloader.setSettings( setting ); + jiraDownloader.setSettings( settings ); - jiraDownloader.setNbEntries( nbEntries ); + jiraDownloader.setNbEntries( maxEntries ); try { @@ -501,6 +464,8 @@ List issues = jiraParser.getIssues(); List releases = jiraParser.getReleases( issues ); + + getLog().info( "Creating announcement file from JIRA releases..." ); doGenerate( releases ); }