You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by hujirong <ji...@gmail.com> on 2012/06/18 04:54:13 UTC
How to develop Maven plugin in eclipse with m2e?
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.html,
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-eclipse-with-m2e-tp5711440.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
RE: How to develop Maven plugin in eclipse with m2e?
Posted by Diego Lin <di...@synnex.com>.
The first thing what you need to do is to check that your local Maven ENV is working normally. Way:
1. Check you have read-write permission on the DIR C:\Users\Administrator\.m2\repository.
2. Run In a command line: mvn dependency:tree or mvn help:effective-pom
3. If the steps above are ok, please paste your pom.xml here.
By the way, like this issue on a local machine, it's better not to build a Nexus ENV, for you will not learn anything behind it.
Diego
Lord Jesus Christ LOVE us, everyone, forever.
-----Original Message-----
From: Barrie Treloar [mailto:baerrach@gmail.com]
Sent: Tuesday, 19 June 2012 05:55
To: Maven Users List
Subject: Re: How to develop Maven plugin in eclipse with m2e?
On Mon, Jun 18, 2012 at 11:15 PM, hujirong <ji...@gmail.com> wrote:
> in local (C:\Users\Administrator\.m2\repository)
Are you logged in as the user "Administrator".
I suspect you are not and you need to configure things to point to your local users setup correctly.
---------------------------------------------------------------------
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: How to develop Maven plugin in eclipse with m2e?
Posted by Barrie Treloar <ba...@gmail.com>.
On Mon, Jun 18, 2012 at 11:15 PM, hujirong <ji...@gmail.com> wrote:
> in local (C:\Users\Administrator\.m2\repository)
Are you logged in as the user "Administrator".
I suspect you are not and you need to configure things to point to
your local users setup correctly.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to develop Maven plugin in eclipse with m2e?
Posted by Wayne Fay <wa...@gmail.com>.
> I was following the above method to create a new mojo project, but couldn't
> pass this error. My internet has no proxy. I can connect to Maven central
> repo with no problem from my browser. I can create the project from maven
> command line with no issue, just can't make it work within eclipse.
Set up Nexus or another Maven Repo Manager and configure things such
that Nexus has no issues connecting to Central, then configure your
developer environment to connect to Nexus for all the artifacts it
needs, and you should not run into these problems.
Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: How to develop Maven plugin in eclipse with m2e?
Posted by hujirong <ji...@gmail.com>.
/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. /
I was following the above method to create a new mojo project, but couldn't
pass this error. My internet has no proxy. I can connect to Maven central
repo with no problem from my browser. I can create the project from maven
command line with no issue, just can't make it work within eclipse.
Could not resolve archetype
org.apache.maven.archetypes:maven-archetype-mojo:RELEASE from any of the
configured repositories.
Could not resolve artifact
org.apache.maven.archetypes:maven-archetype-mojo:pom:RELEASE
Failed to resolve version for
org.apache.maven.archetypes:maven-archetype-mojo:pom:RELEASE: Could not find
metadata org.apache.maven.archetypes:maven-archetype-mojo/maven-metadata.xml
in local (C:\Users\Administrator\.m2\repository)
Failed to resolve version for
org.apache.maven.archetypes:maven-archetype-mojo:pom:RELEASE: Could not find
metadata org.apache.maven.archetypes:maven-archetype-mojo/maven-metadata.xml
in local (C:\Users\Administrator\.m2\repository)
--
View this message in context: http://maven.40175.n5.nabble.com/How-to-develop-Maven-plugin-in-eclipse-with-m2e-tp5711440p5711466.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
RE: How to develop Maven plugin in eclipse with m2e?
Posted by Diego Lin <di...@synnex.com>.
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: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com] 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 <ji...@gmail.com> 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: 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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to develop Maven plugin in eclipse with m2e?
Posted by Anders Hammar <an...@hammar.net>.
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 <ji...@gmail.com> 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.html,
> 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-eclipse-with-m2e-tp5711440.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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org