maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r563720 - in /maven/plugins/trunk/maven-assembly-plugin: maven-assembly-artifact-types/src/main/resources/META-INF/plexus/ src/main/java/org/apache/maven/plugin/assembly/mojos/
Date Wed, 08 Aug 2007 01:45:10 GMT
Author: jdcasey
Date: Tue Aug  7 18:45:09 2007
New Revision: 563720

URL: http://svn.apache.org/viewvc?view=rev&rev=563720
Log:
Fixing some problems with installation and deployment of standardized assembly/component descriptors.

Modified:
    maven/plugins/trunk/maven-assembly-plugin/maven-assembly-artifact-types/src/main/resources/META-INF/plexus/components.xml
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachAssemblyDescriptorMojo.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachComponentDescriptorMojo.java

Modified: maven/plugins/trunk/maven-assembly-plugin/maven-assembly-artifact-types/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/maven-assembly-artifact-types/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=563720&r1=563719&r2=563720
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/maven-assembly-artifact-types/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/maven-assembly-artifact-types/src/main/resources/META-INF/plexus/components.xml
Tue Aug  7 18:45:09 2007
@@ -8,7 +8,7 @@
         <packaging>assembly-component</packaging>
         <classifier>assembly-component</classifier>
         <extension>xml</extension>
-        <type>assembly-component</type>
+        <type>xml</type>
         <addedToClasspath>false</addedToClasspath>
         <includesDependencies>true</includesDependencies>
       </configuration>
@@ -40,7 +40,7 @@
         <packaging>assembly-descriptor</packaging>
         <classifier>assembly-descriptor</classifier>
         <extension>xml</extension>
-        <type>assembly-descriptor</type>
+        <type>xml</type>
         <addedToClasspath>false</addedToClasspath>
         <includesDependencies>true</includesDependencies>
       </configuration>

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachAssemblyDescriptorMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachAssemblyDescriptorMojo.java?view=diff&rev=563720&r1=563719&r2=563720
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachAssemblyDescriptorMojo.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachAssemblyDescriptorMojo.java
Tue Aug  7 18:45:09 2007
@@ -1,5 +1,7 @@
 package org.apache.maven.plugin.assembly.mojos;
 
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -40,12 +42,24 @@
      */
     private MavenProjectHelper projectHelper;
 
+    /**
+     * @component
+     */
+    private ArtifactFactory factory;
+
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
-        File pomFile = project.getFile();
-        project.getArtifact().setFile( pomFile );
-        projectHelper.attachArtifact( project, assemblyDescriptor, handler.getClassifier()
);
+        Artifact artifact = factory.createProjectArtifact( project.getGroupId(), project.getArtifactId(),
project.getVersion() );
+        artifact.setFile( project.getFile() );
+
+        getLog().debug( "Replacing main project artifact with POM artifact: " + artifact.getId()
);
+
+        project.setArtifact( artifact );
+
+        getLog().info( "Attaching assembly descriptor: " + assemblyDescriptor + " to the
main project artifact under type: " + handler.getExtension() + " and classifier: " + handler.getClassifier()
);
+
+        projectHelper.attachArtifact( project, handler.getExtension(), handler.getClassifier(),
assemblyDescriptor );
     }
 
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachComponentDescriptorMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachComponentDescriptorMojo.java?view=diff&rev=563720&r1=563719&r2=563720
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachComponentDescriptorMojo.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachComponentDescriptorMojo.java
Tue Aug  7 18:45:09 2007
@@ -1,5 +1,7 @@
 package org.apache.maven.plugin.assembly.mojos;
 
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -40,12 +42,24 @@
      */
     private MavenProjectHelper projectHelper;
 
+    /**
+     * @component
+     */
+    private ArtifactFactory factory;
+
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
-        File pomFile = project.getFile();
-        project.getArtifact().setFile( pomFile );
-        projectHelper.attachArtifact( project, componentDescriptor, handler.getClassifier()
);
+        Artifact artifact = factory.createProjectArtifact( project.getGroupId(), project.getArtifactId(),
project.getVersion() );
+        artifact.setFile( project.getFile() );
+
+        getLog().debug( "Replacing main project artifact with POM artifact: " + artifact.getId()
);
+
+        project.setArtifact( artifact );
+
+        getLog().info( "Attaching assembly-component descriptor: " + componentDescriptor
+ " to the main project artifact under type: " + handler.getExtension() + " and classifier:
" + handler.getClassifier() );
+
+        projectHelper.attachArtifact( project, handler.getExtension(), handler.getClassifier(),
componentDescriptor );
     }
 
 }



Mime
View raw message