You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vm...@apache.org on 2007/02/17 19:51:19 UTC
svn commit: r508792 - in
/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle:
./ test-extension/ test-extension/src/ test-extension/src/main/
test-extension/src/main/java/ test-...
Author: vmassol
Date: Sat Feb 17 10:51:17 2007
New Revision: 508792
URL: http://svn.apache.org/viewvc?view=rev&rev=508792
Log:
MNG-2831: Cannot add custom artifact handler and custom lifecycle as a build extension
* Added an IT test to show the problem.
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/pom.xml
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/apache/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/apache/maven/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/apache/maven/its/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/apache/maven/its/it0115/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/apache/maven/its/it0115/XarMojo.java
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/resources/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/resources/META-INF/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/resources/META-INF/plexus/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/resources/META-INF/plexus/components.xml
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/pom.xml
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/src/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/src/main/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/src/main/resources/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/src/main/resources/package.xml
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/pom.xml?view=auto&rev=508792
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/pom.xml Sat Feb 17 10:51:17 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.its.it0115</groupId>
+ <artifactId>test-extension</artifactId>
+ <name>Test Extension</name>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2007</inceptionYear>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0</version>
+ </dependency>
+ </dependencies>
+</project>
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/apache/maven/its/it0115/XarMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/apache/maven/its/it0115/XarMojo.java?view=auto&rev=508792
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/apache/maven/its/it0115/XarMojo.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/java/org/apache/maven/its/it0115/XarMojo.java Sat Feb 17 10:51:17 2007
@@ -0,0 +1,80 @@
+package org.apache.maven.its.it0115;
+
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.zip.ZipArchiver;
+
+/**
+ * Gather all resources in a XAR file (which is actually a ZIP file)
+ *
+ * @version $Id: $
+ * @goal xar
+ * @phase package
+ */
+public class XarMojo extends AbstractMojo
+{
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * @see org.apache.maven.plugin.Mojo#execute()
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException
+ {
+ if (this.project.getResources().size() < 1)
+ {
+ this.getLog().warn("No XAR created as no resources were found");
+ return;
+ }
+
+ try
+ {
+ performArchive();
+ }
+ catch (Exception e)
+ {
+ throw new MojoExecutionException("Error while creating XAR file", e );
+ }
+ }
+
+ private void performArchive() throws ArchiverException, IOException
+ {
+ File xarFile = new File(this.project.getBuild().getDirectory(),
+ this.project.getArtifactId() + ".xar" );
+ ZipArchiver archiver = new ZipArchiver();
+ archiver.setDestFile(xarFile);
+ archiver.setIncludeEmptyDirs(false);
+ archiver.setCompress(true);
+ archiver.addDirectory(new File(this.project.getBuild().getOutputDirectory()));
+ archiver.createArchive();
+ this.project.getArtifact().setFile(xarFile);
+ }
+}
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/resources/META-INF/plexus/components.xml?view=auto&rev=508792
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/resources/META-INF/plexus/components.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-extension/src/main/resources/META-INF/plexus/components.xml Sat Feb 17 10:51:17 2007
@@ -0,0 +1,27 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>xar</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <phases>
+ <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+ <package>org.apache.maven.its.it0115:test-extension:xar</package>
+ <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+ </phases>
+ </configuration>
+ </component>
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>xar</role-hint>
+ <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <type>xar</type>
+ <extension>xar</extension>
+ <packaging>xar</packaging>
+ </configuration>
+ </component>
+ </components>
+</component-set>
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/pom.xml?view=auto&rev=508792
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/pom.xml Sat Feb 17 10:51:17 2007
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.its.it0115</groupId>
+ <artifactId>test-project</artifactId>
+ <name>Test Project</name>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2007</inceptionYear>
+
+ <packaging>xar</packaging>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.its.it0115</groupId>
+ <artifactId>test-extension</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </extension>
+ </extensions>
+ </build>
+
+</project>
+
\ No newline at end of file
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/src/main/resources/package.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/src/main/resources/package.xml?view=auto&rev=508792
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/src/main/resources/package.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/it0115-customArtifactHandlerAndCustomLifecycle/test-project/src/main/resources/package.xml Sat Feb 17 10:51:17 2007
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<package>
+ <infos>
+ <name>Backup</name>
+ <description>on Fri Jan 26 09:55:02 CET 2007 by XWiki.Admin</description>
+ <licence></licence>
+ <author>XWiki.Admin</author>
+ <version></version>
+ <backupPack>true</backupPack>
+ </infos>
+ <files/>
+</package>