You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Bernhard Daubner <Be...@uni-bayreuth.de> on 2005/11/21 18:36:15 UTC

[m2] Call a plugin goal from another mojo

I'm looking for a possibility to call within a maven plugin a goal of 
another plugin (within the same maven project).

For example I want to be able to write a Maven2 Plugin that calls the 
Maven-SCM-Plugin to check out a certain revision of the source code and 
then calls a Metrics Plugin to do some measurement on the checked out 
sources.

Last week I already asked about this problem, but I think I was not 
fully unterstood.
Dan Tran suggested to use the maven-embedder. But this seems to be some 
overkill. As far as I have unterstood, the maven embedder should be used 
to use the Maven functionality from "outside" of Maven.

Within the mail archive I found out that there must exist a construct 
called "aggregator" to call other goals. But how do you do that?

The org.apache.maven.lifecycle.DefaultLifecycleExecutor also seems to 
call plugin goals but I don't know how to use it.

Thanks for any hints!
Bernhard




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


Re: [m2] Call a plugin goal from another mojo

Posted by dan tran <da...@gmail.com>.
Hi Bernhard,
 Did you take a look at maven-release-plugin?, it uses Plexus's Commandline
to invoke another plugin
 -Dan


 On 11/21/05, Bernhard Daubner <Be...@uni-bayreuth.de> wrote:
>
> I'm looking for a possibility to call within a maven plugin a goal of
> another plugin (within the same maven project).
>
> For example I want to be able to write a Maven2 Plugin that calls the
> Maven-SCM-Plugin to check out a certain revision of the source code and
> then calls a Metrics Plugin to do some measurement on the checked out
> sources.
>
> Last week I already asked about this problem, but I think I was not
> fully unterstood.
> Dan Tran suggested to use the maven-embedder. But this seems to be some
> overkill. As far as I have unterstood, the maven embedder should be used
> to use the Maven functionality from "outside" of Maven.
>
> Within the mail archive I found out that there must exist a construct
> called "aggregator" to call other goals. But how do you do that?
>
> The org.apache.maven.lifecycle.DefaultLifecycleExecutor also seems to
> call plugin goals but I don't know how to use it.
>
> Thanks for any hints!
> Bernhard
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: [m2] Call a plugin goal from another mojo

Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The term "aggregator" in the context of maven 2 doesn't refer to
aggregation of plugin calls, but aggregation of project handling. It's
an alternative way of processing projects within a reactor where the
plugin is invoked once per build, instead of once per project.

Now, as for calling another plugin, I think you'd be much better off
using the maven-scm API directly, and avoiding the usage of another
plugin. It's made for this type of use case, and using the API directly
you will have access to the full range of options, rather than whatever
the mojo - which is designed to be the front-end for a particular piece
of functionality - chooses to expose.

maven-scm is at:

http://svn.apache.org/repos/asf/maven/scm/trunk

HTH,

john

Bernhard Daubner wrote:
| I'm looking for a possibility to call within a maven plugin a goal of
| another plugin (within the same maven project).
|
| For example I want to be able to write a Maven2 Plugin that calls the
| Maven-SCM-Plugin to check out a certain revision of the source code and
| then calls a Metrics Plugin to do some measurement on the checked out
| sources.
|
| Last week I already asked about this problem, but I think I was not
| fully unterstood.
| Dan Tran suggested to use the maven-embedder. But this seems to be some
| overkill. As far as I have unterstood, the maven embedder should be used
| to use the Maven functionality from "outside" of Maven.
|
| Within the mail archive I found out that there must exist a construct
| called "aggregator" to call other goals. But how do you do that?
|
| The org.apache.maven.lifecycle.DefaultLifecycleExecutor also seems to
| call plugin goals but I don't know how to use it.
|
| Thanks for any hints!
| Bernhard
|
|
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
| For additional commands, e-mail: dev-help@maven.apache.org
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDghoTK3h2CZwO/4URAtZ6AJ4pRJey81K/wlQC7J77njtzPLja2ACZAb3c
pI1PHc5W2zjlE6QfcIqjIZk=
=FEBy
-----END PGP SIGNATURE-----

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