You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Frers,Michael" <Mi...@oclc.org> on 2011/06/27 18:37:52 UTC

simple maven 2 report plugin example

Hi

can anyone help me out and sent me a simple "Hello World" maven report plugin example that works?

I dont get a clue out of the documentation and I cant find a working example in the web.

Thanks
Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: simple maven 2 report plugin example

Posted by jujukiki33 <ju...@gmail.com>.
Please, did you find a solution ? 

I've got the same pbm (NPE DefaultLifecycleExecutor.java:931)



--
View this message in context: http://maven.40175.n5.nabble.com/simple-maven-2-report-plugin-example-tp4529029p5753182.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


AW: simple maven 2 report plugin example

Posted by "Frers,Michael" <Mi...@oclc.org>.
Hi 
I tried again 

<groupId>com.myorg</groupId>
<artifactId>my-report-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>




...
/**
 * @goal report
 */
public class MyReportMojo extends AbstractMavenReport {

    /**
     * @parameter default-value="${project.reporting.outputDirectory}"
     */
    private File outputDirectory;

    /**
     * The Maven Project.
     *
     * @parameter expression="${project}"
     * @required
     * @readonly
     */
    protected MavenProject project;

    /**
     * Doxia Site Renderer.
     *
     * @component
     */
    protected Renderer siteRenderer;

    
    protected void executeReport(Locale arg0) throws MavenReportException {
        Sink sink = getSink();
        sink.head();
        String title = "MYTITLE";
        sink.title();
        sink.text(title);
        sink.title_();
        sink.head_();
        sink.body();
        sink.section1();
        sink.text("BODY TEXT");
        sink.section1_();
        sink.body_();
        sink.flush();
        sink.close();
    }

    protected String getOutputDirectory() {
        return outputDirectory.getAbsolutePath();
    }

    protected MavenProject getProject() {
        return project;
    }

    protected Renderer getSiteRenderer() {
        return siteRenderer;
    }

    public String getDescription(Locale arg0) {
        return "My Site description";
    }

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

    public String getOutputName() {
        return "myreport";
    }
}

I am using this in another project:
...
  <dependency>
            <groupId>com.myorg</groupId>
            <artifactId>my-report-maven-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
  </dependency>
...
  <reporting>
        <plugins>
            <groupId>com.myorg</groupId>
  		<artifactId>my-report-maven-plugin</artifactId>
		<version>1.0-SNAPSHOT</version>            
        </plugins>
  </reporting>
...

And when I execute    
	mvn site
from the command line all I get is

[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getReportExecutions(DefaultLifecycleExecutor.java:931)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getReportExecutions(DefaultLifecycleExecutor.java:904)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:599)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------


Can anyone tell me what I do wrong?







-----Ursprüngliche Nachricht-----
Von: Benson Margulies [mailto:bimargulies@gmail.com] 
Gesendet: Montag, 27. Juni 2011 19:19
An: Maven Users List
Betreff: Re: simple maven 2 report plugin example

Read the source of one.

http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-changes-plugin

On Mon, Jun 27, 2011 at 12:37 PM, Frers,Michael <Mi...@oclc.org> wrote:
> Hi
>
> can anyone help me out and sent me a simple "Hello World" maven report plugin example that works?
>
> I dont get a clue out of the documentation and I cant find a working example in the web.
>
> Thanks
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



Re: simple maven 2 report plugin example

Posted by Benson Margulies <bi...@gmail.com>.
Read the source of one.

http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-changes-plugin

On Mon, Jun 27, 2011 at 12:37 PM, Frers,Michael <Mi...@oclc.org> wrote:
> Hi
>
> can anyone help me out and sent me a simple "Hello World" maven report plugin example that works?
>
> I dont get a clue out of the documentation and I cant find a working example in the web.
>
> Thanks
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org