You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by je...@accenture.com on 2007/01/17 10:48:16 UTC

Your First Plugin Tutorial error ???

Hi,

 

I'm want to write my own plugin to build my company's project.

Now I'm following the "Your First Plugin" Totorial on
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
.

 

I've installed the hello-maven-plugin in my local repository.

Now I want to run this plugin via the command line, mvn
sample.plugin:maven-hello-plugin:1.0-SNAPSHOT:sayhi.

I get the following error:

 

C:\eGovDev\Maven Plugins>mvn
sample.plugin:maven-hello-plugin:1.0-SNAPSHOT

[INFO] Scanning for projects...

[INFO]
------------------------------------------------------------------------

[ERROR] FATAL ERROR

[INFO]
------------------------------------------------------------------------

[INFO] null

[INFO]
------------------------------------------------------------------------

[INFO] Trace

java.lang.NullPointerException

        at
org.apache.maven.plugin.descriptor.PluginDescriptor.getMojo(PluginDes

criptor.java:259)

        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor

(DefaultLifecycleExecutor.java:1524)

        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListBy

AggregationNeeds(DefaultLifecycleExecutor.java:381)

        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi

fecycleExecutor.java:135)

        at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)

        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)

        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:39)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.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]
------------------------------------------------------------------------

[INFO] Total time: < 1 second

[INFO] Finished at: Wed Jan 17 10:35:35 CET 2007

[INFO] Final Memory: 1M/4M

[INFO]
------------------------------------------------------------------------

 

They say something about the goal annotation, that it is needed, but is
it needed in the source code of the mojo ?

Here's the source code:

 

package sample.plugin;

 

import org.apache.maven.plugin.AbstractMojo;

import org.apache.maven.plugin.MojoExecutionException;

import org.apache.maven.plugin.MojoFailureException;

 

/**

 * Says "Hi" to the user. 

 * @goal sayhi

 */

public class GreetingMojo extends AbstractMojo 

{

       public void execute() throws MojoExecutionException,
MojoFailureException 

       {

             getLog().info("Hello, world.");

       }

}

 

The @goal annotation is in comment, but when i write the annotation, i
get an error.

It isn't recognised as an annotation.

 

I guess the FATAL ERROR appears because there's no sayhi annotation.

But how can I add it to this class file ?

 

 

Kind regards.

 

Jelle



This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

Re: Your First Plugin Tutorial error ???

Posted by Tom Huybrechts <to...@gmail.com>.
On 1/17/07, jelle.volckaert@accenture.com <je...@accenture.com> wrote:
> Hi,
>
>
>
> I'm want to write my own plugin to build my company's project.
>
> Now I'm following the "Your First Plugin" Totorial on
> http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
> .
>
>
>
> I've installed the hello-maven-plugin in my local repository.
>
> Now I want to run this plugin via the command line, mvn
> sample.plugin:maven-hello-plugin:1.0-SNAPSHOT:sayhi.
>
> I get the following error:
>
>
>
> C:\eGovDev\Maven Plugins>mvn
> sample.plugin:maven-hello-plugin:1.0-SNAPSHOT

where did the :sayhi go ?

>
> [INFO] Scanning for projects...
>
> [INFO]
> ------------------------------------------------------------------------
>
> [ERROR] FATAL ERROR
>
> [INFO]
> ------------------------------------------------------------------------
>
> [INFO] null
>
> [INFO]
> ------------------------------------------------------------------------
>
> [INFO] Trace
>
> java.lang.NullPointerException
>
>         at
> org.apache.maven.plugin.descriptor.PluginDescriptor.getMojo(PluginDes
>
> criptor.java:259)
>
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor
>
> (DefaultLifecycleExecutor.java:1524)
>
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListBy
>
> AggregationNeeds(DefaultLifecycleExecutor.java:381)
>
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
>
> fecycleExecutor.java:135)
>
>         at
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>
> java:39)
>
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>
> sorImpl.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]
> ------------------------------------------------------------------------
>
> [INFO] Total time: < 1 second
>
> [INFO] Finished at: Wed Jan 17 10:35:35 CET 2007
>
> [INFO] Final Memory: 1M/4M
>
> [INFO]
> ------------------------------------------------------------------------
>
>
>
> They say something about the goal annotation, that it is needed, but is
> it needed in the source code of the mojo ?
>
> Here's the source code:
>
>
>
> package sample.plugin;
>
>
>
> import org.apache.maven.plugin.AbstractMojo;
>
> import org.apache.maven.plugin.MojoExecutionException;
>
> import org.apache.maven.plugin.MojoFailureException;
>
>
>
> /**
>
>  * Says "Hi" to the user.
>
>  * @goal sayhi
>
>  */
>
> public class GreetingMojo extends AbstractMojo
>
> {
>
>        public void execute() throws MojoExecutionException,
> MojoFailureException
>
>        {
>
>              getLog().info("Hello, world.");
>
>        }
>
> }
>
>
>
> The @goal annotation is in comment, but when i write the annotation, i
> get an error.
>
> It isn't recognised as an annotation.
>
>
>
> I guess the FATAL ERROR appears because there's no sayhi annotation.
>
> But how can I add it to this class file ?
>
>
>
>
>
> Kind regards.
>
>
>
> Jelle
>
>
>
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.
>
>

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


Re: Your First Plugin Tutorial error ???

Posted by Arnaud Bailly <ab...@oqube.com>.
<je...@accenture.com> writes:

> Hi,
>
>  
could you please post the pom ?


-- 
OQube < software engineering \ génie logiciel >
Arnaud Bailly, Dr.
\web> http://www.oqube.com


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