maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud Bailly <abai...@oqube.com>
Subject Re: Defining a custom lifecycle
Date Fri, 03 Aug 2007 14:30:05 GMT
Jason van Zyl <jason@maven.org> writes:

> On 3 Aug 07, at 8:51 AM 3 Aug 07, Sebastien Brunot wrote:
>
>> Hey, great news !
>>
>> Any pointer to a documentation for this, or to an entry point class
>> in the source code ?
>>
>
> Here's a full example:
>
> http://svn.codehaus.org/plexus/plexus-appserver/trunk/plexus-
> appserver-maven-plugin/
>

Hello, 
I may be missing something, but the
example you are giving us seems to fall into solution 'one' I talked
about in  a previous mail: custom lifecycle *mapping*.

BTW, I tried to follow Denis Cabasson's advice (yes, I read your 
mails) to implement a custom lifecycle, which after all seems possible
as said in chap. 4 of the maven user guide at Sonatype
(http://www.sonatype.com/book/lifecycle.html). 

Unfortunately it does not work :-( Or at least it does not work as I
think it would work. 
I have a test project with 3 mojos;
 - one: create a file and add one line
 - two: add line to same file
 - one-two: fork customcycle with phase two (or package in the second
   version) 

When I define my lifecycle.xml as this:

<lifecycles>
 <lifecycle>
  <id>customcycle</id>
  <phases>
   <phase>
    <id>one</id>
    <executions>
     <execution>
      <goals>
       <goal>one</goal>
      </goals>
     </execution>
    </executions>
   </phase>
   <phase>
    <id>two</id>
    <executions>
     <execution>
      <goals>
       <goal>two</goal>
      </goals>
     </execution>
    </executions>
   </phase>
  </phases>
 </lifecycle>
</lifecycles>

I got this error in my test:

-------------------------------------------------------------------------------
Test set: oqube.maven.archetype.CustomLifecycleCreationTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.093
sec <<< FAILURE!
callingPluginShouldCreateOneFile(oqube.maven.archetype.CustomLifecycleCreationTest)
Time elapsed: 2.065 sec  <<< FAILURE!
org.apache.maven.it.VerificationException: Exit code was non-zero: 1;
log = 
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'clean'.
....
[INFO] Preparing :one-two
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Unable to find lifecycle for phase 'two'
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Unable to find lifecycle for
phase 'two'
        at
        org.apache.maven.lifecycle.DefaultLifecycleExecutor.getLifecycleForPhase(DefaultLifecycleExecutor.java:916)
        at
        org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:756)
        at

But when I have a lifecycle such as 

<lifecycles>
 <lifecycle>
  <id>customcycle</id>
  <phases>
   <phase>
    <id>compile</id>
    <executions>
     <execution>
      <goals>
       <goal>one</goal>
      </goals>
     </execution>
    </executions>
   </phase>
   <phase>
    <id>package</id>
    <executions>
     <execution>
      <goals>
       <goal>two</goal>
      </goals>
     </execution>
    </executions>
   </phase>
  </phases>
 </lifecycle>
</lifecycles>

It works OK.

So it does not seem indeed possible to create custome lifecycle (in a
plugin ?), that is a sequence of particular phases different from the
standard maven phases. 

Which is the right answer ? 

Regards
-- 
OQube < software engineering \ génie logiciel >
Arnaud Bailly, Dr.
\web> http://www.oqube.com


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


Mime
View raw message