> -----Original Message----- > From: Emmanuel Venisse [mailto:[EMAIL PROTECTED] > Sent: mardi 26 juillet 2005 12:03 > To: Maven Developers List > Subject: Re: svn commit: r225267 - /maven/components/trunk/maven- > plugins/maven-clover- > plugin/src/main/java/org/apache/maven/plugin/clover/CloverReportMojo.java > > Vincent, > > It isn't the best way. You must extends AbstractMavenReport. > > Look at javadoc report and the getOutputName() method in it.
Thanks Emmanuel but it's not only that. You also need to override the generate() method to prevent generation of resources, etc. I still believe the AbstractMavenReport doesn't support external reports. The best may be to have 2 abstract MavenReport implementations: - AbstractExternalMavenReport - AbstractMavenReport I don't think it's right to extend something to negate its effect by overriding one of its key method. Sounds hackish to me ;-) -Vincent > > Emmanuel > > [EMAIL PROTECTED] wrote: > > Author: vmassol > > Date: Tue Jul 26 02:48:04 2005 > > New Revision: 225267 > > > > URL: http://svn.apache.org/viewcvs?rev=225267&view=rev > > Log: > > Do not extend AbstractMavenReport as it does not support externally > generated HTML report files (see MNG-645). Indeed, in our case it is > Clover which generates the report files. > > > > Modified: > > maven/components/trunk/maven-plugins/maven-clover- > plugin/src/main/java/org/apache/maven/plugin/clover/CloverReportMojo.java > > > > Modified: maven/components/trunk/maven-plugins/maven-clover- > plugin/src/main/java/org/apache/maven/plugin/clover/CloverReportMojo.java > > URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven- > plugins/maven-clover- > plugin/src/main/java/org/apache/maven/plugin/clover/CloverReportMojo.java? > rev=225267&r1=225266&r2=225267&view=diff > > > ========================================================================== > ==== > > --- maven/components/trunk/maven-plugins/maven-clover- > plugin/src/main/java/org/apache/maven/plugin/clover/CloverReportMojo.java > (original) > > +++ maven/components/trunk/maven-plugins/maven-clover- > plugin/src/main/java/org/apache/maven/plugin/clover/CloverReportMojo.java > Tue Jul 26 02:48:04 2005 > > @@ -20,10 +20,16 @@ > > import org.apache.maven.project.MavenProject; > > import org.apache.maven.reporting.AbstractMavenReport; > > import org.apache.maven.reporting.MavenReportException; > > +import org.apache.maven.reporting.MavenReport; > > +import org.apache.maven.plugin.AbstractMojo; > > +import org.apache.maven.plugin.MojoExecutionException; > > import org.codehaus.doxia.site.renderer.SiteRenderer; > > +import org.codehaus.doxia.sink.Sink; > > +import org.codehaus.doxia.module.xhtml.XhtmlSink; > > > > import java.util.Locale; > > import java.util.ResourceBundle; > > +import java.io.File; > > > > /** > > * Generate a Clover report. > > @@ -33,8 +39,7 @@ > > * @goal report > > * @execute phase="test" lifecycle="clover" > > */ > > -public class CloverReportMojo > > - extends AbstractMavenReport > > +public class CloverReportMojo extends AbstractMojo implements > MavenReport > > { > > /** > > * @parameter > expression="${project.build.directory}/clover/clover.db" > > @@ -62,6 +67,8 @@ > > */ > > private MavenProject project; > > > > + private File reportOutputDirectory; > > + > > /** > > * @see > org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Loc > ale) > > */ > > @@ -133,5 +140,61 @@ > > public String getName( Locale locale ) > > { > > return getBundle( locale ).getString( "report.clover.name" ); > > + } > > + > > + // The methods below are required because we don't extend > AbstractMavenReport. The reason is that > > + // AbstractMavenReport does not support externally generated HTML > report files. > > + > > + /** > > + * @see > org.apache.maven.reporting.MavenReport#getReportOutputDirectory() > > + */ > > + public File getReportOutputDirectory() > > + { > > + if ( this.reportOutputDirectory == null ) > > + { > > + this.reportOutputDirectory = new File( getOutputDirectory() > ); > > + } > > + return this.reportOutputDirectory; > > + } > > + > > + /** > > + * @see MavenReport#setReportOutputDirectory(java.io.File) > > + */ > > + public void setReportOutputDirectory( File reportOutputDirectory ) > > + { > > + this.reportOutputDirectory = reportOutputDirectory; > > + } > > + > > + /** > > + * @see org.apache.maven.reporting.MavenReport#getCategoryName() > > + */ > > + public String getCategoryName() > > + { > > + return CATEGORY_PROJECT_REPORTS; > > + } > > + > > + /** > > + * @see MavenReport#generate(org.codehaus.doxia.sink.Sink, > java.util.Locale) > > + */ > > + public void generate(Sink sink, Locale locale) throws > MavenReportException > > + { > > + executeReport( locale ); > > + } > > + > > + /** > > + * @see org.apache.maven.plugin.Mojo#execute() > > + */ > > + public void execute() > > + throws MojoExecutionException > > + { > > + try > > + { > > + generate( null, Locale.ENGLISH ); > > + } > > + catch ( Exception e ) > > + { > > + throw new MojoExecutionException( "An error has occurred in > " + getName( Locale.ENGLISH ) > > + + " report generation.", e ); > > + } > > } > > } > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]