You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/10/04 21:53:30 UTC
svn commit: r452992 - in
/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main:
java/org/apache/geronimo/genesis/plugins/tools/SetProjectFileMojo.java
resources/META-INF/plexus/components.xml
Author: jdillon
Date: Wed Oct 4 12:53:30 2006
New Revision: 452992
URL: http://svn.apache.org/viewvc?view=rev&rev=452992
Log:
Add a new mojo to install a specific file as the project's artifact file. Defaults to the projects pom.
Added a custom artifact handler to install application-assembly packaging files as pom xml files.
Hooked up set-project-file to be used in the package phase of application-assembly
This will allow plugins like maven-one-plugin to function as expected with application-assembly packagings
Added:
geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/SetProjectFileMojo.java (with props)
Modified:
geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/resources/META-INF/plexus/components.xml
Added: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/SetProjectFileMojo.java
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/SetProjectFileMojo.java?view=auto&rev=452992
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/SetProjectFileMojo.java (added)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/SetProjectFileMojo.java Wed Oct 4 12:53:30 2006
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.geronimo.genesis.plugins.tools;
+
+import org.apache.geronimo.genesis.MojoSupport;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.artifact.Artifact;
+
+import java.io.File;
+
+/**
+ * Helper to install a specific file (or the projects pom) as the projects artifact file.
+ *
+ * <p>
+ * Custom packaging will need to define a artifact handler plexus component to map desired file extention.
+ * </p>
+ *
+ * @goal set-artifact-file
+ * @phase package
+ *
+ * @version $Rev$ $Date$
+ */
+public class SetProjectFileMojo
+ extends MojoSupport
+{
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * The target file to set as the project's artifact.
+ *
+ * @parameter expression="${project.file}"
+ * @required
+ */
+ private File targetFile;
+
+ protected void doExecute() throws Exception {
+ log.info("Setting artifact file: " + targetFile);
+
+ Artifact artifact = project.getArtifact();
+ artifact.setFile(targetFile);
+ }
+}
\ No newline at end of file
Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/SetProjectFileMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/SetProjectFileMojo.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/SetProjectFileMojo.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=452992&r1=452991&r2=452992
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/resources/META-INF/plexus/components.xml (original)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/resources/META-INF/plexus/components.xml Wed Oct 4 12:53:30 2006
@@ -4,7 +4,7 @@
<component-set>
<components>
-
+
<!--
Custom packaging for application assembly modules.
-->
@@ -19,13 +19,30 @@
<phases>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <package>org.apache.geronimo.genesis.plugins:tools-maven-plugin:set-artifact-file</package>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
</lifecycle>
</lifecycles>
</configuration>
</component>
-
+
+ <!--
+ Install application-assembly artifact files as .pom xml files
+ -->
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>application-assembly</role-hint>
+ <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <type>application-assembly</type>
+ <extension>pom</extension>
+ <packaging>application-assembly</packaging>
+ <addedToClasspath>false</addedToClasspath>
+ <language>xml</language>
+ </configuration>
+ </component>
+
<!--
Custom packaging for testsuite child modules.
-->