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 2010/09/24 23:39:38 UTC

svn commit: r1001089 - in /maven/plugins/trunk/maven-assembly-plugin/src: it/projects/multimodule/multimodule-siblingParent/ it/projects/multimodule/multimodule-siblingParent/child1/ it/projects/multimodule/multimodule-siblingParent/child1/src/ it/proj...

Author: jdcasey
Date: Fri Sep 24 21:39:37 2010
New Revision: 1001089

URL: http://svn.apache.org/viewvc?rev=1001089&view=rev
Log:
[MASSEMBLY-443] Add an IT demonstrating that parent-as-sibling-module works for moduleSet assemblies. Also, a _very_ minor fix in ProjectUtils to try falling back to moduleProject.getFile().getParentFile() if moduleProject.getBasedir() is null for some reason.

Added:
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/pom.xml   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/main/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/main/java/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/main/java/org/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/main/java/org/test/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/main/java/org/test/App.java   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/java/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/java/org/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/java/org/test/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/java/org/test/AppTest.java   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/pom.xml   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/main/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/main/java/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/main/java/org/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/main/java/org/test/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/main/java/org/test/App.java   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/java/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/java/org/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/java/org/test/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/java/org/test/AppTest.java   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/pom.xml   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/src/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/src/assemble/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/src/assemble/src.xml   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.bsh   (with props)
Modified:
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/ProjectUtils.java

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/pom.xml?rev=1001089&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/pom.xml Fri Sep 24 21:39:37 2010
@@ -0,0 +1,19 @@
+<?xml version="1.0"?><project>
+  <parent>
+    <artifactId>parent</artifactId>
+    <groupId>test</groupId>
+    <version>1</version>
+    <relativePath>../parent/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>child1</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/main/java/org/test/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/main/java/org/test/App.java?rev=1001089&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/main/java/org/test/App.java (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/main/java/org/test/App.java Fri Sep 24 21:39:37 2010
@@ -0,0 +1,13 @@
+package org.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/multimodule/multimodule-siblingParent/child1/src/main/java/org/test/App.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/java/org/test/AppTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/java/org/test/AppTest.java?rev=1001089&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/java/org/test/AppTest.java (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/java/org/test/AppTest.java Fri Sep 24 21:39:37 2010
@@ -0,0 +1,38 @@
+package org.test;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child1/src/test/java/org/test/AppTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/pom.xml?rev=1001089&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/pom.xml Fri Sep 24 21:39:37 2010
@@ -0,0 +1,19 @@
+<?xml version="1.0"?><project>
+  <parent>
+    <artifactId>parent</artifactId>
+    <groupId>test</groupId>
+    <version>1</version>
+    <relativePath>../parent/pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>child2</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/main/java/org/test/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/main/java/org/test/App.java?rev=1001089&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/main/java/org/test/App.java (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/main/java/org/test/App.java Fri Sep 24 21:39:37 2010
@@ -0,0 +1,13 @@
+package org.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/multimodule/multimodule-siblingParent/child2/src/main/java/org/test/App.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/java/org/test/AppTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/java/org/test/AppTest.java?rev=1001089&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/java/org/test/AppTest.java (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/java/org/test/AppTest.java Fri Sep 24 21:39:37 2010
@@ -0,0 +1,38 @@
+package org.test;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/child2/src/test/java/org/test/AppTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/pom.xml?rev=1001089&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/pom.xml Fri Sep 24 21:39:37 2010
@@ -0,0 +1,43 @@
+<?xml version="1.0"?><project>
+  <parent>
+    <groupId>org.apache.maven.plugin.assembly.test</groupId>
+    <artifactId>it-project-parent</artifactId>
+    <version>1</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  
+  <groupId>test</groupId>
+  <artifactId>parent</artifactId>
+  <version>1</version>
+  
+  <packaging>pom</packaging>
+  
+  <modules>
+    <module>../child1</module>
+    <module>../child2</module>
+  </modules>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <inherited>false</inherited>
+        <executions>
+          <execution>
+            <id>assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <descriptors>
+                <descriptor>src/assemble/src.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/src/assemble/src.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/src/assemble/src.xml?rev=1001089&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/src/assemble/src.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/src/assemble/src.xml Fri Sep 24 21:39:37 2010
@@ -0,0 +1,30 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+  <id>src</id>
+  <formats>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <moduleSets>
+    <moduleSet>
+      <includes>
+        <include>test:child1</include>
+        <include>test:child2</include>
+      </includes>
+      <sources>
+        <includeModuleDirectory>false</includeModuleDirectory>
+        <fileSets>
+          <fileSet>
+            <outputDirectory>sources/${artifact.artifactId}</outputDirectory>
+            <directory>.</directory>
+            <excludes>
+              <exclude>target/**</exclude>
+              <exclude>**/*~</exclude>
+            </excludes>
+          </fileSet>
+        </fileSets>
+      </sources>
+    </moduleSet>
+  </moduleSets>
+</assembly>

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/src/assemble/src.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.bsh?rev=1001089&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.bsh (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.bsh Fri Sep 24 21:39:37 2010
@@ -0,0 +1,9 @@
+import java.io.*;
+
+boolean result = true;
+
+result = result && new File( basedir, "target/parent-1-src/sources/child1/pom.xml" ).exists();
+
+result = result && !new File( basedir, "target/parent-1-src/sources/child2/pom.xml" ).exists();
+
+return result;

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/multimodule/multimodule-siblingParent/parent/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/ProjectUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/ProjectUtils.java?rev=1001089&r1=1001088&r2=1001089&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/ProjectUtils.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/ProjectUtils.java Fri Sep 24 21:39:37 2010
@@ -144,7 +144,15 @@ public final class ProjectUtils
 
         if ( moduleBasedir == null )
         {
-            moduleBasedir = new File( "." );
+            if ( moduleFile != null )
+            {
+                moduleBasedir = moduleFile.getParentFile();
+            }
+
+            if ( moduleBasedir == null )
+            {
+                moduleBasedir = new File( "." );
+            }
         }
 
         moduleBasedir = moduleBasedir.getCanonicalFile();