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: [email protected]
For additional commands, e-mail: [email protected]