For MNG-706 comments: upgraded org.apache.maven.reporting:maven-reporting-impl to 2.0-beta-3-SNAPSHOT (required for new features in AbstractMavenReportRenderer class, see revision 291668); Updated renderBody() to handle correctly relative path and javadoc plugin as HTML; Added documentation.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@291895 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vincent Siveton 2005-09-27 10:41:19 +00:00
parent e84044cf94
commit 1c5b9d4057
2 changed files with 58 additions and 4 deletions

View File

@ -10,6 +10,17 @@
<name>Maven PLUGIN Plugin</name> <name>Maven PLUGIN Plugin</name>
<version>2.0-beta-3-SNAPSHOT</version> <version>2.0-beta-3-SNAPSHOT</version>
<inceptionYear>2001</inceptionYear> <inceptionYear>2001</inceptionYear>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vincent.siveton@gmail.com</email>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.maven</groupId> <groupId>org.apache.maven</groupId>
@ -35,7 +46,7 @@
<dependency> <dependency>
<groupId>org.apache.maven.reporting</groupId> <groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId> <artifactId>maven-reporting-impl</artifactId>
<version>2.0-beta-1</version> <version>2.0-beta-3-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven</groupId> <groupId>org.apache.maven</groupId>

View File

@ -42,19 +42,24 @@ import java.util.ResourceBundle;
* Generates the Plugin's documentation report. * Generates the Plugin's documentation report.
* *
* @author <a href="snicoll@apache.org">Stephane Nicoll</a> * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
* @version $Id: EarMojo.java 267433 2005-09-03 07:34:07Z brett $ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @version $Id $
* @goal report * @goal report
*/ */
public class PluginReport public class PluginReport
extends AbstractMavenReport extends AbstractMavenReport
{ {
/** /**
* Report output directory.
*
* @parameter expression="${project.build.directory}/generated-site/xdoc" * @parameter expression="${project.build.directory}/generated-site/xdoc"
* @required * @required
*/ */
private String outputDirectory; private String outputDirectory;
/** /**
* Doxia Site Renderer.
*
* @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}" * @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}"
* @required * @required
* @readonly * @readonly
@ -62,6 +67,8 @@ public class PluginReport
private SiteRenderer siteRenderer; private SiteRenderer siteRenderer;
/** /**
* The Maven Project.
*
* @parameter expression="${project}" * @parameter expression="${project}"
* @required * @required
* @readonly * @readonly
@ -69,26 +76,40 @@ public class PluginReport
private MavenProject project; private MavenProject project;
/** /**
* Mojo scanner tools.
*
* @parameter expression="${component.org.apache.maven.tools.plugin.scanner.MojoScanner}" * @parameter expression="${component.org.apache.maven.tools.plugin.scanner.MojoScanner}"
* @required * @required
*/ */
protected MojoScanner mojoScanner; protected MojoScanner mojoScanner;
/**
* @see org.apache.maven.reporting.AbstractMavenReport#getSiteRenderer()
*/
protected SiteRenderer getSiteRenderer() protected SiteRenderer getSiteRenderer()
{ {
return siteRenderer; return siteRenderer;
} }
/**
* @see org.apache.maven.reporting.AbstractMavenReport#getOutputDirectory()
*/
protected String getOutputDirectory() protected String getOutputDirectory()
{ {
return outputDirectory; return outputDirectory;
} }
/**
* @see org.apache.maven.reporting.AbstractMavenReport#getProject()
*/
protected MavenProject getProject() protected MavenProject getProject()
{ {
return project; return project;
} }
/**
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
*/
protected void executeReport( Locale locale ) protected void executeReport( Locale locale )
throws MavenReportException throws MavenReportException
{ {
@ -135,16 +156,25 @@ public class PluginReport
} }
} }
/**
* @see org.apache.maven.reporting.MavenReport#getDescription(java.util.Locale)
*/
public String getDescription( Locale locale ) public String getDescription( Locale locale )
{ {
return getBundle( locale ).getString( "report.plugin.description" ); return getBundle( locale ).getString( "report.plugin.description" );
} }
/**
* @see org.apache.maven.reporting.MavenReport#getName(java.util.Locale)
*/
public String getName( Locale locale ) public String getName( Locale locale )
{ {
return getBundle( locale ).getString( "report.plugin.name" ); return getBundle( locale ).getString( "report.plugin.name" );
} }
/**
* @see org.apache.maven.reporting.MavenReport#getOutputName()
*/
public String getOutputName() public String getOutputName()
{ {
return "plugin-info"; return "plugin-info";
@ -193,11 +223,17 @@ public class PluginReport
this.locale = locale; this.locale = locale;
} }
/**
* @see org.apache.maven.reporting.MavenReportRenderer#getTitle()
*/
public String getTitle() public String getTitle()
{ {
return getBundle( locale ).getString( "report.plugin.title" ); return getBundle( locale ).getString( "report.plugin.title" );
} }
/**
* @see org.apache.maven.reporting.AbstractMavenReportRenderer#renderBody()
*/
public void renderBody() public void renderBody()
{ {
startSection( getTitle() ); startSection( getTitle() );
@ -216,7 +252,11 @@ public class PluginReport
MojoDescriptor mojo = (MojoDescriptor) i.next(); MojoDescriptor mojo = (MojoDescriptor) i.next();
String goalName = mojo.getFullGoalName(); String goalName = mojo.getFullGoalName();
String goalDocumentationLink = mojo.getGoal() + "-mojo.html"; /*
* Added ./ to define a relative path
* @see AbstractMavenReportRenderer#getValidHref(java.lang.String)
*/
String goalDocumentationLink = "./" + mojo.getGoal() + "-mojo.html";
String description = mojo.getDescription(); String description = mojo.getDescription();
if ( StringUtils.isEmpty( mojo.getDescription() ) ) if ( StringUtils.isEmpty( mojo.getDescription() ) )
{ {
@ -224,7 +264,10 @@ public class PluginReport
} }
tableRow( new String[]{createLinkPatternedText( goalName, goalDocumentationLink ), description} ); sink.tableRow();
tableCell( createLinkPatternedText( goalName, goalDocumentationLink ) );
tableCell( description, true );
sink.tableRow_();
} }
endTable(); endTable();