You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2008/09/25 21:13:07 UTC

svn commit: r699057 - in /maven/plugins/trunk/maven-assembly-plugin/src: it/projects/mojo-configuration/massembly-301/ it/projects/mojo-configuration/massembly-301/src/ it/projects/mojo-configuration/massembly-301/src/main/ it/projects/mojo-configurati...

Author: jdcasey
Date: Thu Sep 25 12:13:06 2008
New Revision: 699057

URL: http://svn.apache.org/viewvc?rev=699057&view=rev
Log:
[MASSEMBLY-301] Fix issue with artifacts that have no assemblyId in their coordinate and that have a different type from the main project artifact, so they will be attached instead of incorrectly set to the project main artifact.

Added:
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/goals.txt   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/pom.xml   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/assembly/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/assembly/src.xml   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/java/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/java/test/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/java/test/App.java   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/test.properties   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/verify.bsh   (with props)
Modified:
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/goals.txt?rev=699057&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/goals.txt (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/goals.txt Thu Sep 25 12:13:06 2008
@@ -0,0 +1,2 @@
+clean
+deploy
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/goals.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/pom.xml?rev=699057&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/pom.xml Thu Sep 25 12:13:06 2008
@@ -0,0 +1,37 @@
+
+<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>
+  <parent>
+    <groupId>org.apache.maven.plugin.assembly.test</groupId>
+    <artifactId>it-project-parent</artifactId>
+    <version>1</version>
+  </parent>
+  
+  <groupId>org.test</groupId>
+  <artifactId>massembly-301</artifactId>
+  <packaging>jar</packaging>
+  <version>1</version>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <descriptors>
+                <descriptor>src/main/assembly/src.xml</descriptor>
+              </descriptors>
+              <appendAssemblyId>false</appendAssemblyId>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/assembly/src.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/assembly/src.xml?rev=699057&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/assembly/src.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/assembly/src.xml Thu Sep 25 12:13:06 2008
@@ -0,0 +1,17 @@
+<assembly>
+  <id>src</id>
+  <formats>
+    <format>zip</format>
+    <format>tar.gz</format>
+  </formats>
+  <fileSets>
+    <fileSet>
+      <directory>${project.basedir}</directory>
+      <outputDirectory>/</outputDirectory>
+      <useDefaultExcludes>true</useDefaultExcludes>
+      <excludes>
+        <exclude>target</exclude>
+      </excludes>
+    </fileSet>
+  </fileSets>
+</assembly>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/assembly/src.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/java/test/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/java/test/App.java?rev=699057&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/java/test/App.java (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/java/test/App.java Thu Sep 25 12:13:06 2008
@@ -0,0 +1,13 @@
+package test;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/src/main/java/test/App.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/test.properties?rev=699057&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/test.properties (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/test.properties Thu Sep 25 12:13:06 2008
@@ -0,0 +1 @@
+altDeploymentRepository=test::default::file://${project.build.directory}/deploy
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/test.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/verify.bsh?rev=699057&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/verify.bsh (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/verify.bsh Thu Sep 25 12:13:06 2008
@@ -0,0 +1,38 @@
+import java.io.*;
+
+String base = "target/deploy/org/test/massembly-301/1/massembly-301-1";
+File jar = new File( basedir, base + ".jar" );
+File zip = new File( basedir, base + ".zip" );
+File tgz = new File( basedir, base + ".tar.gz" );
+
+{
+	File f = jar;
+	String type = "main jar";
+	
+	if ( !f.exists() )
+	{
+		System.out.println( "Project " + type + " is missing in deployment repository. File was: " + f );
+	}
+}
+
+{
+	File f = zip;
+	String type = "sources zip";
+	
+	if ( !f.exists() )
+	{
+		System.out.println( "Project " + type + " is missing in deployment repository. File was: " + f );
+	}
+}
+
+{
+	File f = tgz;
+	String type = "sources tar.gz";
+	
+	if ( !f.exists() )
+	{
+		System.out.println( "Project " + type + " is missing in deployment repository. File was: " + f );
+	}
+}
+
+return jar.exists() && zip.exists() && tgz.exists();
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/mojo-configuration/massembly-301/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java?rev=699057&r1=699056&r2=699057&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java Thu Sep 25 12:13:06 2008
@@ -37,7 +37,6 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
 import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
 
 import java.io.File;
 import java.util.Iterator;
@@ -353,6 +352,7 @@
 
                     MavenProject project = getProject();
                     String classifier = getClassifier();
+                    String type = project.getArtifact().getType();
 
                     if ( attach && destFile.isFile() )
                     {
@@ -364,7 +364,7 @@
                         {
                             projectHelper.attachArtifact( project, format, classifier, destFile );
                         }
-                        else
+                        else if ( destFile.getPath().endsWith( type ) )
                         {
                             if ( !warnedAboutMainProjectArtifact )
                             {
@@ -386,6 +386,10 @@
 
                             project.getArtifact().setFile( destFile );
                         }
+                        else
+                        {
+                            projectHelper.attachArtifact( project, format, null, destFile );
+                        }
                     }
                     else
                     {