You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by asookazian <as...@gmail.com> on 2010/07/07 18:46:34 UTC

Creating a Custom Lifecycle

There is some limited coverage of creating a custom lifecycle here:
http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-custom-lifecycle.html

but it also covers forking and parallel lifecycles, I'm not sure I'm really
interested in that.  I want to change the package lifecycle so that it uses
war:explode goal rather than war:war goal.

Is there a good tutorial on how to do this for a very simple custom
lifecycle?
-- 
View this message in context: http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tp1044781p1044781.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Creating a Custom Lifecycle

Posted by Martin Höller <ma...@xss.co.at>.
Am Freitag, 9. Juli 2010 08:04:20 schrieb Martin Höller:
> Am Freitag, 9. Juli 2010 00:38:37 schrieb asookazian:
> > Thanks!  Now I just need to write a simple Mojo/plugin that will copy the
> > exploded EAR directory to the server/default/deploy directory in JBoss.
> > cool.
>
> Or you use the maven-antrun-plugin and save yourself some work :)

The cargo plugin is usually used for depolying artifacts to containers and it 
seems, it can also deploy exploded wars (I haven't use this feature). See 
http://old.nabble.com/-mvn----reloadable-webapps-to7702892.html#a7715823 or 
use google for some details.

hth,
- martin

Re: Creating a Custom Lifecycle

Posted by asookazian <as...@gmail.com>.
I'm going to stick with my Ant build.xml explode target that hooks into maven
via <macrodef>.  I was trying to avoid using Ant with Maven but it's taking
too long to get the exploded WAR+EAR working with Maven and JBoss...

<target name="unzip">
		<echo message="**************Beginning unzip target..."/>
		<echo message="Base directory is ${basedir}" />	
		<mkdir dir="${basedir}\target\${ear.app.name}\temp"/>
		<unzip src="${basedir}\target\${ear.app.name}\${war.app.name}.war"
dest="${basedir}\target\${ear.app.name}\temp"/>
		<delete file="${basedir}\target\${ear.app.name}\${war.app.name}.war"/>
		<mkdir dir="${basedir}\target\${ear.app.name}\${war.app.name}.war"/>
		<copy todir="${basedir}\target\${ear.app.name}\${war.app.name}.war">
			<fileset dir="${basedir}\target\${ear.app.name}\temp" />
		</copy>
		<delete dir="${basedir}\target\${ear.app.name}\temp"/>
	</target>
	
	<target name="install">
		<echo message="**************Beginning install target..."/>
		<maven target="install" basedir="${basedir}">
			<arg line="-f ${pom.file} -npu -Dmaven.test.skip=true" />
		</maven>
	</target>

	<target name="clean">
	     <echo message="**************Beginning clean target..."/>
	     <echo message="Deleting
${basedir}\com.echo.cis.gui.ear\target\${ear.app.name}\temp directory"/>
	     <delete
dir="${basedir}\com.echo.cis.gui.ear\target\${ear.app.name}\temp"/>
	     <maven target="clean" basedir="${basedir}">
		 <arg line="-f ${pom.file}" />
	     </maven>
	</target>

	<!-- <target name="explode" depends="showproperties, clean, install, unzip"
description="Runs mvn clean install and then unzips the EAR/WAR and copies
to JBoss deploy directory"> -->
	<target name="explode" depends="showproperties, clean, install, unzip">
		<echo message="**************Beginning explode target..."/>
		<mkdir
dir="${jboss.home}/server/${jboss.profile}/deploy/${ear.app.name}.ear" />
		<copy
todir="${jboss.home}/server/${jboss.profile}/deploy/${ear.app.name}.ear">
			<fileset dir="${artifact.dir}" />
		</copy>
		<tstamp>  
		    <format property="now" pattern="MM/dd/yyyy hh:mm:ss" locale="en,US"/>  
		</tstamp>  
		<echo message="Current datetime: ${now}"/>
		<echo message="The app can be accessed at ${final.url}" />
	</target>
-- 
View this message in context: http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tp1044781p1045597.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Creating a Custom Lifecycle

Posted by asookazian <as...@gmail.com>.

Martin Höller wrote:
> 
> Am Freitag, 9. Juli 2010 00:38:37 schrieb asookazian:
>> Thanks!  Now I just need to write a simple Mojo/plugin that will copy the
>> exploded EAR directory to the server/default/deploy directory in JBoss.
>> cool.
> 
> Or you use the maven-antrun-plugin and save yourself some work :)
> 
> hth,
> - martin
> 
>  
> 

I modified the HardDeployMojo in the jboss-maven-plugin so that it copies
the exploded EAR directory and not the packaged EAR file.  But the copied
exploded EAR does not deploy cleanly in JBoss AS 4.2.2.GA (nor does the
packaged EAR).  There are several NPEs in the server.log and I'm not sure
why...
-- 
View this message in context: http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tp1044781p1045577.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Creating a Custom Lifecycle

Posted by Martin Höller <ma...@xss.co.at>.
Am Freitag, 9. Juli 2010 00:38:37 schrieb asookazian:
> Thanks!  Now I just need to write a simple Mojo/plugin that will copy the
> exploded EAR directory to the server/default/deploy directory in JBoss.
> cool.

Or you use the maven-antrun-plugin and save yourself some work :)

hth,
- martin

Re: Creating a Custom Lifecycle

Posted by asookazian <as...@gmail.com>.

stephenconnolly wrote:
> 
> have you had a look at the unpackTypes configuration option of m-ear-p?
> 
> 

That was exactly what I needed and it worked (I just did this in my
profile):

<build>
                <pluginManagement>
                    <plugins>
                         <plugin>
					        <groupId>org.apache.maven.plugins</groupId>
					        <artifactId>maven-ear-plugin</artifactId>
					        <version>2.3.1</version>
					        <configuration>
					          <unpackTypes>war</unpackTypes>					          
					        </configuration>
					   </plugin>
					                       
                    </plugins>
                </pluginManagement>
            </build>

Thanks!  Now I just need to write a simple Mojo/plugin that will copy the
exploded EAR directory to the server/default/deploy directory in JBoss. 
cool.
-- 
View this message in context: http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tp1044781p1045261.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Creating a Custom Lifecycle

Posted by Stephen Connolly <st...@gmail.com>.
have you had a look at the unpackTypes configuration option of m-ear-p?

On 8 July 2010 16:28, asookazian <as...@gmail.com> wrote:

>
>
> Martin Höller wrote:
> >
> > Am Mittwoch, 7. Juli 2010 18:46:34 schrieb asookazian:
> >> There is some limited coverage of creating a custom lifecycle here:
> >>
> http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-cu
> >>stom-lifecycle.html
> >>
> >> but it also covers forking and parallel lifecycles, I'm not sure I'm
> >> really
> >> interested in that.  I want to change the package lifecycle so that it
> >> uses
> >> war:explode goal rather than war:war goal.
> >
> > What about just configuring the war:explode goal in your pom.xml? war:war
> > would still be executed, but is this a problem?
> >
> > hth,
> > - martin
> >
> >
> >
>
> I just realized something very basic after reading first chapter of Maven
> 2:
> Effective Implementation.  "The web application archive is produced in the
> target directory, which is Maven's default working directory.  There you
> will find both the target/simple-webapp subdirectory that contains the
> exploded, or unpacked, web application contents ready to be packaged, and
> the target/simple-webapp.war file that contains those files after the
> packaging process."
>
> So perhaps if the unpack goal of the jboss-maven-plugin was modified to use
> the already exploded WAR in the exploded EAR, then we would be good.  At
> least as far as JBoss users are concerned...
>
> public void unpack( File zipFile, File targetDir )
>        throws IOException
>    {
>        FileInputStream in = new FileInputStream( zipFile );
>        ZipInputStream zipIn = new ZipInputStream( in );
>
>        File dir = targetDir.getCanonicalFile();
>        dir.mkdirs();
>        ZipEntry entry;
>        while ( ( entry = zipIn.getNextEntry() ) != null )
>        {
>            if ( entry.isDirectory() )
>            {
>                continue;
>            }
>            String file = targetDir + "/" + entry.getName();
>
>            new File( file ).getParentFile().getCanonicalFile().mkdirs();
>
>            FileOutputStream out = new FileOutputStream( file );
>            streamcopy( zipIn, out );
>            out.close();
>        }
>        zipIn.close();
>    }
>
>
> http://svn.codehaus.org/mojo/tags/jboss-maven-plugin-1.4.1/src/main/java/org/codehaus/mojo/jboss/HardDeployMojo.java
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tp1044781p1045103.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Creating a Custom Lifecycle

Posted by Justin Edelson <ju...@gmail.com>.
On 7/8/10 11:28 AM, asookazian wrote:
> I just realized something very basic after reading first chapter of Maven 2:
> Effective Implementation.  "The web application archive is produced in the
> target directory, which is Maven's default working directory.  There you
> will find both the target/simple-webapp subdirectory that contains the
> exploded, or unpacked, web application contents ready to be packaged, and
> the target/simple-webapp.war file that contains those files after the
> packaging process."
> 
> So perhaps if the unpack goal of the jboss-maven-plugin was modified to use
> the already exploded WAR in the exploded EAR, then we would be good.  At
> least as far as JBoss users are concerned...
No. The way that dependencies go from project to project is via
artifacts installed/deployed into the local repository.

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


Re: Creating a Custom Lifecycle

Posted by asookazian <as...@gmail.com>.

Martin Höller wrote:
> 
> Am Mittwoch, 7. Juli 2010 18:46:34 schrieb asookazian:
>> There is some limited coverage of creating a custom lifecycle here:
>> http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-cu
>>stom-lifecycle.html
>>
>> but it also covers forking and parallel lifecycles, I'm not sure I'm
>> really
>> interested in that.  I want to change the package lifecycle so that it
>> uses
>> war:explode goal rather than war:war goal.
> 
> What about just configuring the war:explode goal in your pom.xml? war:war 
> would still be executed, but is this a problem?
> 
> hth,
> - martin
> 
>  
> 

I just realized something very basic after reading first chapter of Maven 2:
Effective Implementation.  "The web application archive is produced in the
target directory, which is Maven's default working directory.  There you
will find both the target/simple-webapp subdirectory that contains the
exploded, or unpacked, web application contents ready to be packaged, and
the target/simple-webapp.war file that contains those files after the
packaging process."

So perhaps if the unpack goal of the jboss-maven-plugin was modified to use
the already exploded WAR in the exploded EAR, then we would be good.  At
least as far as JBoss users are concerned...

public void unpack( File zipFile, File targetDir )
        throws IOException
    {
        FileInputStream in = new FileInputStream( zipFile );
        ZipInputStream zipIn = new ZipInputStream( in );

        File dir = targetDir.getCanonicalFile();
        dir.mkdirs();
        ZipEntry entry;
        while ( ( entry = zipIn.getNextEntry() ) != null )
        {
            if ( entry.isDirectory() )
            {
                continue;
            }
            String file = targetDir + "/" + entry.getName();

            new File( file ).getParentFile().getCanonicalFile().mkdirs();

            FileOutputStream out = new FileOutputStream( file );
            streamcopy( zipIn, out );
            out.close();
        }
        zipIn.close();
    }

http://svn.codehaus.org/mojo/tags/jboss-maven-plugin-1.4.1/src/main/java/org/codehaus/mojo/jboss/HardDeployMojo.java
-- 
View this message in context: http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tp1044781p1045103.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Creating a Custom Lifecycle

Posted by Martin Höller <ma...@xss.co.at>.
Am Mittwoch, 7. Juli 2010 18:46:34 schrieb asookazian:
> There is some limited coverage of creating a custom lifecycle here:
> http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-cu
>stom-lifecycle.html
>
> but it also covers forking and parallel lifecycles, I'm not sure I'm really
> interested in that.  I want to change the package lifecycle so that it uses
> war:explode goal rather than war:war goal.

What about just configuring the war:explode goal in your pom.xml? war:war 
would still be executed, but is this a problem?

hth,
- martin

Re: Creating a Custom Lifecycle

Posted by asookazian <as...@gmail.com>.
Getting closer.  Now using war:exploded (see below).  So in order to wrap
this up (for an exploded EAR), there are a few steps required.  The mojo for
the maven-ear-plugin (which doesn't have an exploded goal!) needs to be
modified to add the exploded goal.  Then the exploded WAR needs to be copied
into the appropriate directory in the exploded EAR.  Finally, for a 'mvn
install', the EAR would need to be packaged to be installed into the local
Maven repo.

2nd thought: the exploded EAR is already available prior to the packaging of
the EAR during 'mvn install'.  So adding the exploded goal to the
maven-ear-plugin is not required.  Even better.

Now the problem is to actually provide all the appropriate phases in the
components.xml below...

components.xml

<component-set>
  <components>
    <component>
      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
      <role-hint>exploded</role-hint>
      <implementation>
        org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
      </implementation>
      <configuration>
        <phases>          
          <process-resources>
            org.apache.maven.plugins:maven-resources-plugin:resources
          </process-resources>
          <compile>
            org.apache.maven.plugins:maven-compiler-plugin:compile
          </compile>
         
<!--<package>org.apache.maven.plugins:maven-zip-plugin:exploded</package>-->
         
<package>org.apache.maven.plugins:maven-war-plugin:exploded</package>
        </phases>
      </configuration>
    </component>
  </components>
</component-set>
-- 
View this message in context: http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tp1044781p1044822.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Creating a Custom Lifecycle

Posted by asookazian <as...@gmail.com>.
Ok, looks like it's working now.  

components.xml:

<component-set>
  <components>
    <component>
      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
      <role-hint>exploded</role-hint>
      <implementation>
        org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
      </implementation>
      <configuration>
        <phases>
          <validate>
            org.apache.maven.plugins:maven-validate-plugin:validate
          </validate>
          <process-resources>
            org.apache.maven.plugins:maven-resources-plugin:resources
          </process-resources>
          <compile>
            org.apache.maven.plugins:maven-compiler-plugin:compile
          </compile>
         
<package>org.apache.maven.plugins:maven-zip-plugin:exploded</package>
        </phases>
      </configuration>
    </component>
  </components>
</component-set>

POM for web app:

<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.intuit</groupId>
  <artifactId>testapp</artifactId>
  <!-- <packaging>war</packaging> -->
  <packaging>exploded</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Maven Webapp Archetype</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>testapp</finalName>  
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-zip-plugin</artifactId>
          <version>1.0-SNAPSHOT</version>
          <extensions>true</extensions>          
        </plugin>    
      </plugins>
  </build>
</project>

lifecycle.xml:

<lifecycles>
  <lifecycle>
    <id>zipcycle</id>
    <phases>
      <phase>
        <id>package</id>
        <executions>
          <execution>
            <goals>
              <goal>exploded</goal>
            </goals>
          </execution>
        </executions>
      </phase>
    </phases>
  </lifecycle>
</lifecycles>

ZipForkMojo:

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;


/**
 * @goal exploded
 * @execute lifecycle="zipcycle" phase="package"
 */
public class ZipForkMojo extends AbstractMojo
{
  public void execute()
    throws MojoExecutionException
  {
    getLog().info( "doing nothing here" );
  }
}

maven-zip-plugin mojo POM:

<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>org.apache.maven.plugins</groupId>
  <artifactId>maven-zip-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>maven-zip-plugin Maven Mojo</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>2.0</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

console output from 'mvn clean install' of webapp POM:

C:\Documents and Settings\asookazian\My
Documents\ubuntu_projects.tar\projects\t
estapp>mvn clean install
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building Maven Webapp Archetype
[INFO]    task-segment: [clean, install]
[INFO]
------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\Documents and Settings\asookazian\My
Documents\ubun
tu_projects.tar\projects\testapp\target
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered
resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] Preparing zip:exploded
[WARNING] Removing: exploded from forked lifecycle, to prevent recursive
invocat
ion.
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered
resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] [zip:exploded]
[INFO] doing nothing here
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Wed Jul 07 11:58:22 PDT 2010
[INFO] Final Memory: 6M/11M
[INFO]
------------------------------------------------------------------------

So now the point is that b/c the default lifecycle is being overridden, many
of the phases in the lifecycle are missing in the components.xml descriptor.

I tried to add validate which is not valid:

<validate>
      org.apache.maven.plugins:maven-validate-plugin:validate
</validate>

b/c that plugin does not exist.

How do you know which plugin a lifecycle phase is associated with?  mvn
help:describe?
-- 
View this message in context: http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tp1044781p1044816.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Creating a Custom Lifecycle

Posted by asookazian <as...@gmail.com>.
Ok so here is my initial attempt at overriding (or creating) a lifecycle.  My
goal is to override the package phase (specifically the war:war with
war:explode).  I followed the example here:
http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-override-default-lifecycle.html

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

Here is the code:

lifecycles.xml:

<lifecycles>
  <lifecycle>
    <id>zipcycle</id>
    <phases>
      <phase>
        <id>package</id>
        <executions>
          <execution>
            <goals>
              <goal>explode</goal>
            </goals>
          </execution>
        </executions>
      </phase>
    </phases>
  </lifecycle>
</lifecycles>

components.xml:

<component-set>
  <components>
    <component>
      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
      <role-hint>zip</role-hint>
      <implementation>
        org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
      </implementation>
      <configuration>
        <phases>
          <process-resources>
            org.apache.maven.plugins:maven-resources-plugin:resources
          </process-resources>
          <compile>
            org.apache.maven.plugins:maven-compiler-plugin:compile
          </compile>
          <package>org.apache.maven.plugins:maven-zip-plugin:zip</package>
        </phases>
      </configuration>
    </component>
  </components>
</component-set>

POM for my archetype generated via 'mvn archetype:generate': 64: remote ->
maven-archetype-webapp (An archetype which contains a sample Maven Webapp
project.): 

<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.intuit</groupId>
  <artifactId>testapp</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Maven Webapp Archetype</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>testapp</finalName>  
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-zip-plugin</artifactId>
          <version>1.0-SNAPSHOT</version>
          <extensions>true</extensions>
  	  <executions>
  		<execution>
  		    <id>ZipForkMojo</id>
  		    <phase>package</phase>
  		    <goals>
  			<goal>touch</goal>
  		    </goals>
  		</execution>
          </executions>
        </plugin>    
      </plugins>
  </build>
</project>

ZipForkMojo:

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;


/**
 * @goal touch
 * @phase package
 */
public class ZipForkMojo extends AbstractMojo
{
  public void execute()
    throws MojoExecutionException
  {
    getLog().info( "doing nothing here" );
  }
}

maven-zip-plugin POM:

<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>org.apache.maven.plugins</groupId>
  <artifactId>maven-zip-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>maven-zip-plugin Maven Mojo</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>2.0</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

result of issuing 'mvn clean install' cmd:

C:\Documents and Settings\asookazian\My
Documents\ubuntu_projects.tar\projects\t
estapp>mvn clean install
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building Maven Webapp Archetype
[INFO]    task-segment: [clean, install]
[INFO]
------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\Documents and Settings\asookazian\My
Documents\ubun
tu_projects.tar\projects\testapp\target
[INFO] Ignoring available plugin update: 2.5 as it requires Maven version
2.0.9
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered
resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] [resources:testResources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered
resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Documents and
Settings\asookazian\
My Documents\ubuntu_projects.tar\projects\testapp\src\test\resources
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [war:war]
[INFO] Packaging webapp
[INFO] Assembling webapp[testapp] in [C:\Documents and
Settings\asookazian\My Do
cuments\ubuntu_projects.tar\projects\testapp\target\testapp]
[INFO] Processing war project
[INFO] Copying webapp resources[C:\Documents and Settings\asookazian\My
Document
s\ubuntu_projects.tar\projects\testapp\src\main\webapp]
[INFO] Webapp assembled in [47 msecs]
[INFO] Building war: C:\Documents and Settings\asookazian\My
Documents\ubuntu_pr
ojects.tar\projects\testapp\target\testapp.war
[INFO] [zip:touch {execution: ZipForkMojo}]
[INFO] doing nothing here
[INFO] [install:install]
[INFO] Installing C:\Documents and Settings\asookazian\My
Documents\ubuntu_proje
cts.tar\projects\testapp\target\testapp.war to C:\Documents and
Settings\asookaz
ian\.m2\repo2\com\intuit\testapp\1.0-SNAPSHOT\testapp-1.0-SNAPSHOT.war
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Jul 07 11:06:57 PDT 2010
[INFO] Final Memory: 9M/17M
[INFO]
------------------------------------------------------------------------

So the war:war goal is still being exec'd but at least my plugin's execute
method is invoked as well.  Any ideas how to fix this so the override
actually works?  thx.
-- 
View this message in context: http://maven.40175.n5.nabble.com/Creating-a-Custom-Lifecycle-tp1044781p1044808.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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