You can create a project by means of a Maven command, like mvn 
archetype:generate

In Eclipse with M2Eclipse or m2e, you can do:

In the create a new project wizard --> Maven Project, in the next slide, DON'T 
check "Create a simple project", go next, select "maven-archetype-mojo"(maybe 
need to wait a few seconds) and next, give some necessary info, click finish, 
then the project is created, whose name is the artifactId you specified, and 
the classes MyMojo is created too.


Note: If one wants to run a maven command in a short way, you have to do these 
steps:

1. Add the following into the settings.xml:
  <pluginGroups>
    <pluginGroup>com.synnex.maven-plugin</pluginGroup><!-- GroupId -->
  </pluginGroups>

2. Add the following into the pom.xml:
    <plugins>
      <plugin>
        <artifactId>maven-plugin-plugin</artifactId>
        <configuration>
          <goalPrefix>snx-release</goalPrefix>
        </configuration>
      </plugin>
    </plugins>

3. The mojo is like:
/**
 * @goal uat
 */
public class UatMojo extends AbstractMojo {


Then you can use this mojo in a command: mvn snx-release:uat


Hope this can help you. Lord Jesus Christ LOVE you all.


Thanks,
Diego


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Anders Hammar
Sent: Monday, 18 June 2012 14:54
To: Maven Users List
Subject: Re: How to develop Maven plugin in eclipse with m2e?

You most likely haven't configured a dependency to the 
org.apache.maven:maven-plugin-api library.

What you might want to try is to checkout an existing (working) Maven plugin 
and verify that that works in your Eclipse environment first.

/Anders

On Mon, Jun 18, 2012 at 4:54 AM, hujirong <[email protected]> wrote:
> Hi
>
> Is there a tutorial on how to develop my own Maven plugin within 
> eclipse with m2e installed?
>
> I installed Indigo and can use m2e to run Maven project inside the eclipse.
> Now I want to use this environment to write my own Maven plugins. 
> What's do I need to do? I am not a regular java developer anymore. 
> When I try to follow this sample, 
> http://maven.apache.org/guides/plugin/guide-java-plugin-development.ht
> ml,
> and this eclipse tutorial
> http://www.vogella.com/articles/Eclipse/article.html, I got all 
> compile errors say can't resolve import 
> org.apache.maven.plugin.AbstractMojo;
>
> Thanks
> Jirong
>
> --
> View this message in context: 
> http://maven.40175.n5.nabble.com/How-to-develop-Maven-plugin-in-eclips
> e-with-m2e-tp5711440.html Sent from the Maven - Users mailing list 
> archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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]

Reply via email to