maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k957 <k...@68k.org>
Subject Re: custom maven plugin default phase
Date Fri, 19 Feb 2010 17:26:54 GMT

> The list of phases is defined in maven... you cannot define your own phases
> without building your own custom maven. (Notice the full stop is after

I haven't done my due diligence and looked at the maven code, or tried it 
out - so I am talking from general impressions and doc </qualifier>

But, couldn't you create your own custom lifecycle and configure phases 
with any id(s) you like in the lifecycle.xml?

http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-custom-lifecycle.html



...Not that the OP needs/wants their own lifecycle.




On Fri, 19 Feb 2010, Stephen Connolly wrote:

> maven... I'm not talking about your own maven plugin, or any of that.... i'm
> talking about forking maven and building your own fork... with all the pain
> that goes along with that... trust me you don't want to do that)
>
> If you want to bind your plugin to pre-existing phases, then you must either
> create your own packaging type (will will require you to add your plugin
> with <extensions>true</extensions> IIRC) or you need to use <executions>
to
> bind the plugin to the lifecycle of the packaging type you currently have.
>
> The first case would give you a pom that looks a little like:
>
> <project>
>  ...
>  <packaging>mypackaging</packaging>
>  ...
>  <build>
>    <plugins>
>      <plugin>
>        <groupId>com.mycompany</groupId>
>        <artifactId>myplugin-maven-plugin</artifactId>
>        <version>1.0</version>
>        <extensions>true</extensions>
>      </plugin>
>    </plugins>
>  </build>
> </project>
>
> The second case can (if you annotate your mojo's with the default phases
> they should run in)
>
> <project>
>  ...
>  <build>
>    <plugins>
>      <plugin>
>        <groupId>com.mycompany</groupId>
>        <artifactId>myplugin-maven-plugin</artifactId>
>        <version>1.0</version>
>        <executions>
>          <execution>
>            <goals>
>              <goal>mygoal1</goal>
>              <goal>mygoal2</goal>
>              <goal>mygoal3</goal>
>            </goals>
>          </execution>
>        </executions>
>      </plugin>
>    </plugins>
>  </build>
> </project>
>
> [Note that if mygoal1 has a default binding of generate-sources phase,
> mygoal2 has a default binding of generate-test-resources phase and mygoal3
> has a default binding of package phase, then as we did not specify a phase
> in the execution, each goal will be executed in their default phase... which
> helps keep things short and sweet]
>
> -Stephen
>
> On 19 February 2010 07:58, Annies, Sebastian <sebastian.annies@coremedia.com
>> wrote:
>
>> As far As i understood it you won't succeed. Either you have to create your
>> own lifecycle or you will have to specify an <execution>
>> Hopefully someone will prove me wrong.
>>
>> Gre,
>> Sebastian
>>
>>
>> Von meinem iPod gesendet
>>
>> Am 17.02.2010 um 17:08 schrieb "tbee" <tbee@tbee.org>:
>>
>>
>>
>>> I've create a custom maven plugin and can start it from a project, but I
>>> need
>>> to explicitely configure the phase in which it will execute. I cannot seem
>>> to find any (good) documentation on how to configure a default phase it
>>> should in. I would like to only include the plugin in the project's pom
>>> and
>>> that's it.
>>> --
>>> View this message in context:
>>> http://old.nabble.com/custom-maven-plugin-default-phase-tp27626122p27626122.html
>>> Sent from the Maven Developers mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>

Mime
View raw message