I've written some documentation about that recently:

http://docs.codehaus.org/display/MAVENUSER/Write+your+own+report+plugin

Feel free to add your experiences.

-Gisbert

Arnaud Bailly wrote:
Benoit Xhenseval <[EMAIL PROTECTED]> writes:


hI *

What would be the recommended way to generate a report that fits in
the Maven 2 site?


Do you mean project's documentation or automatic plugin report ?

In the former case, you can use format APT that is documented on maven
sites. This is a wiki like format easier to handle than xdoc.



What is the recommended way?  Is there any good example?


You can look at the source code of any report plugin. To speed up
things a bit, here is a sample I have made for custom plugin (without
java verbosity):


/**
 * A maven 2.0 plugin for generating images of the automata in a FIDL
 * descriptor. This plugin is used in the <code>site</code> phase to generate
 * HTML pages describing the specifications of each automaton in a given set of
 * files.
* * * @author nono
 * @goal fidl-graph
 * @phase site
 */
public class GraphGeneratorMojo extends AbstractMavenReport {


  /**
   * <i>Maven Internal</i>: The Doxia Site Renderer.
* * @component
   */
  private Renderer siteRenderer;

  /**
   * <i>Maven Internal</i>: The Project descriptor.
   * @parameter expression="${project}"
   * @required
   * @readonly
   */
  private MavenProject project;


  /*
   * (non-Javadoc)
* * @see org.apache.maven.reporting.AbstractMavenReport#getOutputDirectory()
   */
  protected String getOutputDirectory() {
    return outputDirectory.getAbsolutePath();
  }

  /**
   * @return Returns the siteRenderer.
   */
  public Renderer getSiteRenderer() {
    return siteRenderer;
  }

  protected MavenProject getProject() {
    return project;
  }

  protected void executeReport(Locale arg0) throws MavenReportException {
    Sink sink = getSink();
    /* write */
    sink.head();
    sink.title();
    sink.text("FIDL graph report");
    sink.title_();
    sink.head_();

    sink.body();
    sink.section1();

    sink.sectionTitle1();
    sink.text("FIDL automata index");
    sink.sectionTitle1_();
    sink.lineBreak();
    sink.lineBreak();

    sink
        .text("List of behavioral elements with link to graphical representation of 
FIDL automata.");

    sink.lineBreak();
    makeLinks(sink);
    sink.section1_();
    sink.body_();
    sink.flush();
    sink.close();

  }

  public String getOutputName() {
    return "fidl/index";
  }

  public String getName(Locale arg0) {
    return "FIDL Graph report";
  }

  public String getDescription(Locale arg0) {
    return "Generate graph and HTML summary for FIDL specification";
  }


  /**
   * @param outputDirectory
   *          The outputDirectory to set.
   */
  public void setOutputDirectory(File outputDirectory) {
    this.outputDirectory = outputDirectory;
  }

  /**
   * @param siteRenderer
   *          The siteRenderer to set.
   */
  public void setSiteRenderer(Renderer siteRenderer) {
    this.siteRenderer = siteRenderer;
  }

  /**
   * For testing purpose only.
   * @param project The project to set.
   */
  public void setProject(MavenProject project) {
    this.project = project;
  }

}

Actually, you use an abstract output format (sink).


Where would it be documented?


Unfortunately, nowhere I am aware of.
HTH

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to