You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Benson Margulies <bi...@gmail.com> on 2009/12/25 17:00:00 UTC

Can a plugin have a default execution/goal?

I've tried posing this question before, but while I've elicited
follow-up questions, I've never seemed to get to the bottom of it.

What I want is for a plugin to execute simply by being included in the
<plugins/> element of the POM, without needing to explicitly configure
an <execution/> or a <goal/>. What I expected what that declaring an
@phase and an @goal in the comments on the Mojo class would do this.
However, I have not been able to get it to work. Nothing happens
without an execution. I have this feeling that I'm missing something
simple here. Either that, or this really isn't possible, and it is the
'super-POM' that arranges executions of all the standard plugins.

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


RE: Can a plugin have a default execution/goal?

Posted by Martin Gainty <mg...@hotmail.com>.
Tran is correct

here is an example pom.xml contents which specifies defaultGoal of 'install' for the enumerated plugins
<build>
    <plugins>
               <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>2.0.2</version>
              <groupId>org.apache.maven.plugins</groupId>
                 <configuration>
                 </configuration>
           </plugin>
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>2.0-beta-7</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.3</version>
                    <configuration>
                        <includes>
                            <include>**/*Test.java</include>
                        </includes>
                        <excludes>
                            <exclude>**/TestBean.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <configuration>
                        <preparationGoals>clean verify install</preparationGoals>
                    </configuration>
                </plugin>
                <plugin>
                      <artifactId>maven-jar-plugin</artifactId>
                      <configuration>
                        <archive>
                          <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        </archive>
                      </configuration>
                </plugin>
        </plugins>
        <defaultGoal>install</defaultGoal>
    </build>

HTH
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Fri, 25 Dec 2009 10:05:19 -0800
> Subject: Re: Can a plugin have a default execution/goal?
> From: dantran@gmail.com
> To: users@maven.apache.org
> 
> Normally you dont pick a goal but a phase instead ( compile, package,
> install etc )
> 
> your can run the goal ( ex eclipse:eclipse ) if it is supported to run
> from command line
> 
> On Fri, Dec 25, 2009 at 9:21 AM, Benson Margulies <bi...@gmail.com> wrote:
> >> To automatically run your plugin's goal, it must be part of of maven
> >> default build cycle ( maven-compile-plugin ) is an example.)
> >> So change default lifecycle is not possible since its belongs to maven core.
> >>
> >
> > Does that mean that I can pick a goal name that is already in the
> > lifecycle, and it will run? Or is the lifecycle specified by specific
> > plugins?
> >
> > ---------------------------------------------------------------------
> > 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
> 
 		 	   		  
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/171222986/direct/01/

Re: Can a plugin have a default execution/goal?

Posted by Dan Tran <da...@gmail.com>.
Normally you dont pick a goal but a phase instead ( compile, package,
install etc )

your can run the goal ( ex eclipse:eclipse ) if it is supported to run
from command line

On Fri, Dec 25, 2009 at 9:21 AM, Benson Margulies <bi...@gmail.com> wrote:
>> To automatically run your plugin's goal, it must be part of of maven
>> default build cycle ( maven-compile-plugin ) is an example.)
>> So change default lifecycle is not possible since its belongs to maven core.
>>
>
> Does that mean that I can pick a goal name that is already in the
> lifecycle, and it will run? Or is the lifecycle specified by specific
> plugins?
>
> ---------------------------------------------------------------------
> 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: Can a plugin have a default execution/goal?

Posted by Benson Margulies <bi...@gmail.com>.
> To automatically run your plugin's goal, it must be part of of maven
> default build cycle ( maven-compile-plugin ) is an example.)
> So change default lifecycle is not possible since its belongs to maven core.
>

Does that mean that I can pick a goal name that is already in the
lifecycle, and it will run? Or is the lifecycle specified by specific
plugins?

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


Re: Can a plugin have a default execution/goal?

Posted by Dan Tran <da...@gmail.com>.
Hi Benson,

By default all plugin's goal/mojo must be invoked via plugin's execution.

In each execution's configuration, you dont need to set 'phase' if
your plugin's mojo already set it in the source anotation

To automatically run your plugin's goal, it must be part of of maven
default build cycle ( maven-compile-plugin ) is an example.)
So change default lifecycle is not possible since its belongs to maven core.

However, you can still create your custom lifecycle to do so.  see
native-maven-plugin for example if you really want to go that far :-)

-Dan

On Fri, Dec 25, 2009 at 8:00 AM, Benson Margulies <bi...@gmail.com> wrote:
> I've tried posing this question before, but while I've elicited
> follow-up questions, I've never seemed to get to the bottom of it.
>
> What I want is for a plugin to execute simply by being included in the
> <plugins/> element of the POM, without needing to explicitly configure
> an <execution/> or a <goal/>. What I expected what that declaring an
> @phase and an @goal in the comments on the Mojo class would do this.
> However, I have not been able to get it to work. Nothing happens
> without an execution. I have this feeling that I'm missing something
> simple here. Either that, or this really isn't possible, and it is the
> 'super-POM' that arranges executions of all the standard plugins.
>
> ---------------------------------------------------------------------
> 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