Thanks for your answer John! :o)

Best Regards / Cordialement,
Fabrice BELLINGARD
DINQ/DSIN/INSI/EATE/IDVS/AIDV
(+33) (01 61) 45 15 91  -  [EMAIL PROTECTED]


                                                                       
             John Casey                                                
             <[EMAIL PROTECTED]                                          
             ava.org>                                                 Pour
                                       Maven Users List                
             18/10/2005 17:04          <users@maven.apache.org>        
                                                                        cc
                                                                       
                 Veuillez                                            Objet
                répondre à             Re: [m2] Running a goal only once
             Maven Users List          in a multiproject context       
             <[EMAIL PROTECTED]                                          
                 che.org>                                              
                                                                       
                                                                       
                                                                       
                                                                       




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Try adding the class-level annotation:

@aggregator

to your mojo. This will tell the mojo to only execute at the top level.
If you need access to the List of project instances in the current
build, use the following:

/**
~ * @parameter default-value="${reactorProjects}"
~ * @required
~ * @readonly
~ */
private java.util.List reactorProjects;

Also, if you want it to execute before anything else in the build, you
can bind it to the 'initialize' phase using:

<phase>initialize</phase>

within the execution specification for the plugin. NOTE: you'll also
have to enumerate the goals you want to run in a
<goals><goal>myMojo</goal></goals> section, also within the execution
specification.


To answer your second question, try adding the following to your
plugin's POM:

<build>
...
~  <plugins>
~    <plugin>
~      <artifactId>maven-plugin-plugin</artifactId>
~      <configuration>
~        <prefix>myPluginPrefix</prefix>
~      </configuration>
~    </plugin>
~  </plugins>
...
</build>

When you re-install/deploy the plugin, this *should* allow you to specify:

m2 myPluginPrefix:myMojo

rather than referring to it by groupId:artifactId[:version]:goal.

Cheers,

john

[EMAIL PROTECTED] wrote:
|
|
|
| Hi,
|
| I have defined a Mojo that does some work (create some necessary folders,
| init some dynamic values, ...) before running an install over my
| multi-module project. When I run "m2 myGroupId:myArtifactId:myGoal
install"
| on my master project, my goal gets executed for each submodule while I
need
| it to be executed only once at the very beginning of the build.
| Is there a way to tell the Mojo that it must be executed only once? I
| looked at the "plugin.xml" file placed in the META-INF of the plugin,
but I
| can't figure out what the different parameters are for
| (requiresDirectInvocation, inheritedByDefault, executionStrategy, ...).
|
| Btw, is there also a way to define an alias so that I don't need to write
| "m2 myGroupId:myArtifactId:myGoal", but only "m2 shortId:myGoal" for
| instance ?
|
| Thanks for your help!
|
| Best Regards / Cordialement,
| Fabrice BELLINGARD
| DINQ/DSIN/INSI/EATE/IDVS/AIDV
| (+33) (01 61) 45 15 91  -  [EMAIL PROTECTED]
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDVQ7sK3h2CZwO/4URAjfcAKCcsMYU71YCHoMoiDbmjvDdqEaCzgCeJYSY
1reEdoqWeJ3WtQA9hRAVMS4=
=zV4b
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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