You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Siegfried Heintze <si...@heintze.com> on 2005/11/03 16:19:25 UTC

Documentation for writing Pluggins for M2?

Is there any documentation for writing pluggins for M2? Could someone kindly
point me to it?
Thanks,
Siegfried


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


Re: Documentation for writing Pluggins for M2?

Posted by Jan Bartel <ja...@mortbay.com>.
Siegfried,

I am far from being a Maven expert, but AFAIK, "Mojo" is 
a play on the words "Maven" "Pojo". 

You write a Java class that implements the Mojo api. You basically
implement the execute() method to do the work of your plugin. Put 
in the pom.xml of the project  <packaging>maven-plugin</packaging>,
follow the instructions about the markup directives to put in your
class, run the mvn plugin:install goal and you should be off 
to a good start. 

For enumerating dependencies, you can use the org.apache.maven.project.MavenProject
object. You set it as a parameter on your plugin like this:

   /**
     * The maven project.
     *
     * @parameter expression="${project}"
     * @required
     * @readonly
     */
    private MavenProject project;

I found it very useful to download the Maven source at look at the source
of some plugins to see how they work. There are instructions on the Maven
site for downloading the source. Then look in maven-plugins subdirectory
to find the source of the plugins.

cheers
Jan


Siegfried Heintze wrote:
> Ahhh --- OK, this is progress. I've been searching the archives for
> "execution" to learn how to create a custom goal to execute my program and I
> have not had any luck. 
> 
> What is "mojo"?
> 
> I guess if I want to write a little for loop to enumerate the dependencies
> in my POM there is probably a way to do that in
> org.apache.maven.plugin.Mojo. But where is the javadoc for
> org.apache.maven.plugin.Mojo? I don't see any links and I am scrolling the
> entirety of
> http://maven.apache.org/maven2/developers/mojo-api-specification.html!
> Surely this project has javadocs!
> 
> And I suppose that after I figure out how to enumerate POM dependencies then
> I use the ant javadocs to call ant and execute my program?
> 
> Thanks,
> Siegfried
> 
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Jan Bartel
> Sent: Thursday, November 03, 2005 8:30 AM
> To: users@maven.apache.org
> Subject: Re: Documentation for writing Pluggins for M2?
> 
> Siegfried,
> 
> Here's a link to writing a plugin in Java:
> 
> http://maven.apache.org/maven2/guides/plugin/guide-java-plugin-development.h
> tml
> 
> And here's a link to the API:
> 
> http://maven.apache.org/maven2/developers/mojo-api-specification.html
> 
> regards,
> Jan
> 
> Siegfried Heintze wrote:
> 
>>Is there any documentation for writing pluggins for M2? Could someone
> 
> kindly
> 
>>point me to it?
>>Thanks,
>>Siegfried
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Documentation for writing Pluggins for M2?

Posted by Siegfried Heintze <si...@heintze.com>.
Ahhh --- OK, this is progress. I've been searching the archives for
"execution" to learn how to create a custom goal to execute my program and I
have not had any luck. 

What is "mojo"?

I guess if I want to write a little for loop to enumerate the dependencies
in my POM there is probably a way to do that in
org.apache.maven.plugin.Mojo. But where is the javadoc for
org.apache.maven.plugin.Mojo? I don't see any links and I am scrolling the
entirety of
http://maven.apache.org/maven2/developers/mojo-api-specification.html!
Surely this project has javadocs!

And I suppose that after I figure out how to enumerate POM dependencies then
I use the ant javadocs to call ant and execute my program?

Thanks,
Siegfried

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Jan Bartel
Sent: Thursday, November 03, 2005 8:30 AM
To: users@maven.apache.org
Subject: Re: Documentation for writing Pluggins for M2?

Siegfried,

Here's a link to writing a plugin in Java:

http://maven.apache.org/maven2/guides/plugin/guide-java-plugin-development.h
tml

And here's a link to the API:

http://maven.apache.org/maven2/developers/mojo-api-specification.html

regards,
Jan

Siegfried Heintze wrote:
> Is there any documentation for writing pluggins for M2? Could someone
kindly
> point me to it?
> Thanks,
> Siegfried


---------------------------------------------------------------------
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: Documentation for writing Pluggins for M2?

Posted by Jan Bartel <ja...@mortbay.com>.
Siegfried,

Here's a link to writing a plugin in Java:

http://maven.apache.org/maven2/guides/plugin/guide-java-plugin-development.html

And here's a link to the API:

http://maven.apache.org/maven2/developers/mojo-api-specification.html

regards,
Jan

Siegfried Heintze wrote:
> Is there any documentation for writing pluggins for M2? Could someone kindly
> point me to it?
> Thanks,
> Siegfried


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


RE: Documentation for writing Pluggins for M2?

Posted by Yann Le Du <le...@yahoo.com>.
http://maven.apache.org/guides/introduction/introduction-to-plugins.html

--- Siegfried Heintze <si...@heintze.com> a écrit :

> Is there any documentation for writing pluggins for M2? Could someone kindly
> point me to it?
> Thanks,
> Siegfried
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 



	

	
		
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com

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