List,

I'm investigating the use of Maven as a project lifecycle management
tool for solution deployment projects that we do at my company.  I have
so far defined 2 goals in my mojo, validate and install, which
correspond to the 2 initial phases of our specific lifecycle (validate >
install > patch > overlay > load > test > report).

As far as my current understanding goes, it is not (yet?) possible to
define an entirely custom lifecycle in Maven, only to map mojo goals to
phases in one of the existing lifecycles, the default lifecycle being,
as it were, the default.

My components.xml and lifecycle.xml files are as follows:

<component-set>
  <components>
    <component>
      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
      <role-hint>fast-gs-project</role-hint>
 
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMappi
ng</implementation>
      <configuration>
        <phases>
 
<validate>com.fastsearch.gs.mojo:maven-esp-plugin:validate</validate>
 
<compile>com.fastsearch.gs.mojo:maven-esp-plugin:install</compile>
        </phases>
      </configuration>
    </component>
  </components>
</component-set>

<lifecycles>
  <lifecycle>
    <id>fast-gs-project</id>
    <phases>
      <phase>
        <id>validate</id>
        <executions>
          <execution>
            <goals>
              <goal>validate</goal>
            </goals>
          </execution>
        </executions>
      </phase>
      <phase>
        <id>compile</id>
        <executions>
          <execution>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </phase>
    </phases>
  </lifecycle>
</lifecycles>

(Note that I have mapped the 'install' goal to the 'compile' phase in
the default lifecycle.)

However, when I run Maven on a sample project, its behaviour i somewhat
strange:

----
C:\cygwin\home\blehra\eclipsework\default\sampleproj>mvn esp:install
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'esp'.
[INFO]
------------------------------------------------------------------------
----
[INFO] Building Sample Project
[INFO]    task-segment: [esp:install]
[INFO]
------------------------------------------------------------------------
----
[INFO] Preparing esp:install
[WARNING] Removing: install from forked lifecycle, to prevent recursive
invocation.
[INFO] Preparing esp:validate
[WARNING] Removing: install from forked lifecycle, to prevent recursive
invocation.
[WARNING] Removing: validate from forked lifecycle, to prevent recursive
invocation.
[INFO] No goals needed for project - skipping
[INFO] [esp:validate]
[INFO] Project is valid
[INFO] Preparing esp:validate
[WARNING] Removing: install from forked lifecycle, to prevent recursive
invocation.
[WARNING] Removing: validate from forked lifecycle, to prevent recursive
invocation.
[INFO] No goals needed for project - skipping
[INFO] [esp:validate]
[INFO] Project is valid
[INFO] [esp:install]
[INFO]
------------------------------------------------------------------------
----
[INFO] FAST Maven Installer starting up...
[INFO]   Customer:        customer
[INFO]   Project:         project
[INFO]   Target env:      test
[INFO]   Local host:      ablehr.laptop.net
[INFO]   Local base dir:
C:\cygwin\home\blehra\eclipsework\default\sampleproj
[INFO]   Install profile:
<basedir>\custom\resources\test\InstallProfile.xml
[INFO]
------------------------------------------------------------------------
----
[INFO] Reading install profile and connecting to hosts...
[INFO]   ESP version:     5.1.3
[INFO]   Platform:        Linux
[INFO]   Remote command:  SSH2
[INFO]   Target hosts:
[INFO]     - test48.oslo.fast.no
[INFO]     - test66.oslo.fast.no
[INFO]     - test117.oslo.fast.no (admin)
[INFO]     - test123.oslo.fast.no
[INFO]
------------------------------------------------------------------------
----
[INFO] Checking if ESP 5.1.3 is installed on hosts in configuration...
[INFO]   -> test48.oslo.fast.no: Running OK
[INFO]   -> test66.oslo.fast.no: Running OK
[INFO]   -> test117.oslo.fast.no: Running OK
[INFO]   -> test123.oslo.fast.no: Running OK
[INFO] ESP 5.1.3 is installed on all hosts in configuration, nothing to
do.
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 16 seconds
[INFO] Finished at: Wed Sep 12 13:05:53 CEST 2007
[INFO] Final Memory: 2M/5M
[INFO]
------------------------------------------------------------------------

C:\cygwin\home\blehra\eclipsework\default\sampleproj>
----

My questions:

1.
The 'validate' goal is invoked twice in a row; why and how to avoid?

2.
I'm getting the message 'No goals needed for project - skipping', which
according to a posting here from Brett Porter on 17 Nov 2005 means that
'the module has a packaging of POM or something else that doesn't define
any goals for the lifecycle step you are running'.  Should I be worried?

3.
I'm getting warnings that <goal> has been 'removed from lifecycle, to
prevent recursive invocation'.  Should I be worried (guess not), and if
not, is it possible to disable this message (without hacking the Maven
sources, I mean)?


The POM for my sample project is the following:

<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.fastsearch.gs</groupId>
  <artifactId>sampleproj</artifactId>
  <packaging>fast-gs-project</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Sample Project</name>
  <url>http://www.fastsearch.com</url>
  <build>
    <plugins>
      <plugin>
        <groupId>com.fastsearch.gs.mojo</groupId>
        <artifactId>maven-esp-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <customer>customer</customer>
          <engagement>project</engagement>
          <engagementPrefix>prefix</engagementPrefix>
        </configuration>
      </plugin>           
    </plugins>
  </build>
  <dependencies/>
</project>

I'm rather new to Maven so I may be missing some key pieces of
information on how to set up custom mojos and goals, but I thought I'd
post my questions here anyway in case someone has light to shed.

Thanks,
- Anders.

Anders Blehr
Senior Solutions Architect
FAST
Torggata 2-4-6
N-0181 Oslo, Norway
www.fastsearch.com

Reply via email to