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 18:09:59 UTC
svn commit: r1000934 - in /maven/plugins/trunk/maven-assembly-plugin/src:
it/projects/components/ it/projects/components/component-dependencySet/
it/projects/components/component-dependencySet/src/
it/projects/components/component-dependencySet/src/mai...
Author: jdcasey
Date: Fri Sep 24 16:09:58 2010
New Revision: 1000934
URL: http://svn.apache.org/viewvc?rev=1000934&view=rev
Log:
[MASSEMBLY-288] Allow moduleSets from componentDescriptors.
Added:
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/pom.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/bin.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/depset.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/java/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/java/test/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/java/test/App.java
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/test/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/test/java/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/test/java/test/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/test/java/test/AppTest.java
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/pom.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/main/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/main/java/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/main/java/test/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/main/java/test/App.java
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/test/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/test/java/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/test/java/test/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/test/java/test/AppTest.java
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/pom.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/bin.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/modset.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/pom.xml
Modified:
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
maven/plugins/trunk/maven-assembly-plugin/src/main/mdo/component.mdo
maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/pom.xml?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/pom.xml Fri Sep 24 16:09:58 2010
@@ -0,0 +1,53 @@
+<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/xsd/maven-4.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>test</groupId>
+ <artifactId>parent</artifactId>
+ <version>1</version>
+ <packaging>jar</packaging>
+
+ <name>parent</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <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/bin.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/bin.xml?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/bin.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/bin.xml Fri Sep 24 16:09:58 2010
@@ -0,0 +1,9 @@
+<assembly>
+ <id>bin</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <componentDescriptors>
+ <componentDescriptor>src/main/assembly/depset.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
\ No newline at end of file
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/depset.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/depset.xml?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/depset.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/assembly/depset.xml Fri Sep 24 16:09:58 2010
@@ -0,0 +1,7 @@
+<component>
+ <dependencySets>
+ <dependencySet>
+ <scope>test</scope>
+ </dependencySet>
+ </dependencySets>
+</component>
\ No newline at end of file
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/java/test/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/java/test/App.java?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/java/test/App.java (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/main/java/test/App.java Fri Sep 24 16:09:58 2010
@@ -0,0 +1,13 @@
+package test;
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/test/java/test/AppTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/test/java/test/AppTest.java?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/test/java/test/AppTest.java (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-dependencySet/src/test/java/test/AppTest.java Fri Sep 24 16:09:58 2010
@@ -0,0 +1,38 @@
+package 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 );
+ }
+}
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/pom.xml?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/pom.xml Fri Sep 24 16:09:58 2010
@@ -0,0 +1,17 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>parent</artifactId>
+ <groupId>test</groupId>
+ <version>1</version>
+ </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>
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/main/java/test/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/main/java/test/App.java?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/main/java/test/App.java (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/main/java/test/App.java Fri Sep 24 16:09:58 2010
@@ -0,0 +1,13 @@
+package test;
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/test/java/test/AppTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/test/java/test/AppTest.java?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/test/java/test/AppTest.java (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child1/src/test/java/test/AppTest.java Fri Sep 24 16:09:58 2010
@@ -0,0 +1,38 @@
+package 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 );
+ }
+}
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/pom.xml?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/pom.xml Fri Sep 24 16:09:58 2010
@@ -0,0 +1,41 @@
+<?xml version='1.0'?>
+<project>
+ <parent>
+ <artifactId>parent</artifactId>
+ <groupId>test</groupId>
+ <version>1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>child2</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>test</groupId>
+ <artifactId>child1</artifactId>
+ <version>1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-binary-assembly</id>
+ <phase>package</phase>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assemble/bin.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/bin.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/bin.xml?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/bin.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/bin.xml Fri Sep 24 16:09:58 2010
@@ -0,0 +1,12 @@
+<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>bin</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <componentDescriptors>
+ <componentDescriptor>src/assemble/modset.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/modset.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/modset.xml?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/modset.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/child2/src/assemble/modset.xml Fri Sep 24 16:09:58 2010
@@ -0,0 +1,19 @@
+<component>
+ <moduleSets>
+ <moduleSet>
+ <includes>
+ <include>test:child1</include>
+ </includes>
+
+ <useAllReactorProjects>true</useAllReactorProjects>
+ <binaries>
+ <unpack>false</unpack>
+ <dependencySets>
+ <dependencySet>
+ <scope>test</scope>
+ </dependencySet>
+ </dependencySets>
+ </binaries>
+ </moduleSet>
+ </moduleSets>
+</component>
\ No newline at end of file
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/pom.xml?rev=1000934&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/components/component-moduleSet/pom.xml Fri Sep 24 16:09:58 2010
@@ -0,0 +1,19 @@
+<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/xsd/maven-4.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>test</groupId>
+ <artifactId>parent</artifactId>
+ <version>1</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>child1</module>
+ <module>child2</module>
+ </modules>
+</project>
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java?rev=1000934&r1=1000933&r2=1000934&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/AssemblyReader.java Fri Sep 24 16:09:58 2010
@@ -25,7 +25,6 @@ import org.apache.maven.plugin.assembly.
import org.apache.maven.plugin.assembly.model.Assembly;
import java.io.File;
-import java.io.Reader;
import java.util.List;
/**
@@ -43,9 +42,6 @@ public interface AssemblyReader
public Assembly getAssemblyFromDescriptorFile( File file, AssemblerConfigurationSource configSource )
throws AssemblyReadException, InvalidAssemblerConfigurationException;
- public Assembly readAssembly( Reader reader, String locationDescription, AssemblerConfigurationSource configSource )
- throws AssemblyReadException, InvalidAssemblerConfigurationException;
-
public void includeSiteInAssembly( Assembly assembly, AssemblerConfigurationSource configSource )
throws MojoFailureException, InvalidAssemblerConfigurationException;
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java?rev=1000934&r1=1000933&r2=1000934&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java Fri Sep 24 16:09:58 2010
@@ -19,8 +19,6 @@ package org.apache.maven.plugin.assembly
* under the License.
*/
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
@@ -34,19 +32,17 @@ import org.apache.maven.plugin.assembly.
import org.apache.maven.plugin.assembly.model.DependencySet;
import org.apache.maven.plugin.assembly.model.FileItem;
import org.apache.maven.plugin.assembly.model.FileSet;
+import org.apache.maven.plugin.assembly.model.ModuleSet;
import org.apache.maven.plugin.assembly.model.Repository;
import org.apache.maven.plugin.assembly.model.io.xpp3.AssemblyXpp3Reader;
import org.apache.maven.plugin.assembly.model.io.xpp3.AssemblyXpp3Writer;
import org.apache.maven.plugin.assembly.model.io.xpp3.ComponentXpp3Reader;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.io.location.ArtifactLocatorStrategy;
import org.apache.maven.shared.io.location.ClasspathResourceLocatorStrategy;
import org.apache.maven.shared.io.location.FileLocatorStrategy;
import org.apache.maven.shared.io.location.Location;
import org.apache.maven.shared.io.location.Locator;
import org.apache.maven.shared.io.location.LocatorStrategy;
-import org.apache.maven.shared.io.location.URLLocatorStrategy;
-import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
@@ -80,34 +76,17 @@ public class DefaultAssemblyReader
implements AssemblyReader
{
- @Requirement
- private ArtifactFactory factory;
-
- @Requirement
- private ArtifactResolver resolver;
-
public List<Assembly> readAssemblies( final AssemblerConfigurationSource configSource )
throws AssemblyReadException, InvalidAssemblerConfigurationException
{
final Locator locator = new Locator();
- final LocatorStrategy prefixedClasspathStrategy = new PrefixedClasspathLocatorStrategy( "/assemblies/" );
- final LocatorStrategy classpathStrategy = new ClasspathResourceLocatorStrategy();
-
final List<LocatorStrategy> strategies = new ArrayList<LocatorStrategy>();
strategies.add( new RelativeFileLocatorStrategy( configSource.getBasedir() ) );
-
- strategies.add( new ArtifactLocatorStrategy( factory, resolver, configSource.getLocalRepository(),
- configSource.getRemoteRepositories(), "xml", "assembly-descriptor" ) );
-
- strategies.add( prefixedClasspathStrategy );
- strategies.add( classpathStrategy );
strategies.add( new FileLocatorStrategy() );
- strategies.add( new URLLocatorStrategy() );
final List<LocatorStrategy> refStrategies = new ArrayList<LocatorStrategy>();
- refStrategies.add( prefixedClasspathStrategy );
- refStrategies.add( classpathStrategy );
+ refStrategies.add( new PrefixedClasspathLocatorStrategy( "/assemblies/" ) );
final List<Assembly> assemblies = new ArrayList<Assembly>();
@@ -257,7 +236,7 @@ public class DefaultAssemblyReader
{
// TODO use ReaderFactory.newXmlReader() when plexus-utils is upgraded to 1.4.5+
final Assembly assembly =
- readAssembly( new InputStreamReader( resourceAsStream, "UTF-8" ), ref, configSource );
+ readAssembly( new InputStreamReader( resourceAsStream, "UTF-8" ), ref, null, configSource );
assemblies.add( assembly );
return assembly;
@@ -292,7 +271,8 @@ public class DefaultAssemblyReader
{
// TODO use ReaderFactory.newXmlReader() when plexus-utils is upgraded to 1.4.5+
r = new InputStreamReader( new FileInputStream( descriptor ), "UTF-8" );
- final Assembly assembly = readAssembly( r, descriptor.getAbsolutePath(), configSource );
+ final Assembly assembly =
+ readAssembly( r, descriptor.getAbsolutePath(), descriptor.getParentFile(), configSource );
assemblies.add( assembly );
@@ -338,7 +318,15 @@ public class DefaultAssemblyReader
{
// TODO use ReaderFactory.newXmlReader() when plexus-utils is upgraded to 1.4.5+
r = new InputStreamReader( location.getInputStream(), "UTF-8" );
- final Assembly assembly = readAssembly( r, spec, configSource );
+
+ File dir = null;
+ if ( location.getFile() != null )
+ {
+ dir = location.getFile()
+ .getParentFile();
+ }
+
+ final Assembly assembly = readAssembly( r, spec, dir, configSource );
assemblies.add( assembly );
@@ -355,8 +343,8 @@ public class DefaultAssemblyReader
}
- public Assembly readAssembly( final Reader reader, final String locationDescription,
- final AssemblerConfigurationSource configSource )
+ protected Assembly readAssembly( final Reader reader, final String locationDescription, final File assemblyDir,
+ final AssemblerConfigurationSource configSource )
throws AssemblyReadException, InvalidAssemblerConfigurationException
{
Assembly assembly;
@@ -379,7 +367,7 @@ public class DefaultAssemblyReader
final AssemblyXpp3Reader r = new AssemblyXpp3Reader();
assembly = r.read( reader );
- mergeComponentsWithMainAssembly( assembly, configSource );
+ mergeComponentsWithMainAssembly( assembly, assemblyDir, configSource );
debugPrintAssembly( "Before assembly is interpolated:", assembly );
@@ -435,33 +423,26 @@ public class DefaultAssemblyReader
* Add the contents of all included components to main assembly
*
* @param assembly
+ * @param assemblyDir
* @throws AssemblyReadException
* @throws MojoFailureException
* @throws MojoExecutionException
*/
- protected void mergeComponentsWithMainAssembly( final Assembly assembly,
+ protected void mergeComponentsWithMainAssembly( final Assembly assembly, final File assemblyDir,
final AssemblerConfigurationSource configSource )
throws AssemblyReadException
{
- final RelativeFileLocatorStrategy rfls = new RelativeFileLocatorStrategy( configSource.getBasedir() );
-
- // allow absolute paths in componentDescriptor... MASSEMBLY-486
- final FileLocatorStrategy afls = new FileLocatorStrategy();
-
- final ClasspathResourceLocatorStrategy crls = new ClasspathResourceLocatorStrategy();
-
- final ArtifactLocatorStrategy als =
- new ArtifactLocatorStrategy( factory, resolver, configSource.getLocalRepository(),
- configSource.getRemoteRepositories(), "assembly-component" );
+ final Locator locator = new Locator();
- final URLLocatorStrategy uls = new URLLocatorStrategy();
+ if ( assemblyDir != null && assemblyDir.exists() && assemblyDir.isDirectory() )
+ {
+ locator.addStrategy( new RelativeFileLocatorStrategy( assemblyDir ) );
+ }
- final Locator locator = new Locator();
- locator.addStrategy( rfls );
- locator.addStrategy( afls );
- locator.addStrategy( als );
- locator.addStrategy( crls );
- locator.addStrategy( uls );
+ // allow absolute paths in componentDescriptor... MASSEMBLY-486
+ locator.addStrategy( new RelativeFileLocatorStrategy( configSource.getBasedir() ) );
+ locator.addStrategy( new FileLocatorStrategy() );
+ locator.addStrategy( new ClasspathResourceLocatorStrategy() );
final AssemblyExpressionEvaluator aee = new AssemblyExpressionEvaluator( configSource );
@@ -563,6 +544,12 @@ public class DefaultAssemblyReader
assembly.addRepository( repository );
}
+
+ final List<ModuleSet> moduleSets = component.getModuleSets();
+ for ( final ModuleSet moduleSet : moduleSets )
+ {
+ assembly.addModuleSet( moduleSet );
+ }
}
public void includeSiteInAssembly( final Assembly assembly, final AssemblerConfigurationSource configSource )
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=1000934&r1=1000933&r2=1000934&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 Fri Sep 24 16:09:58 2010
@@ -155,7 +155,7 @@ public abstract class AbstractAssemblyMo
private String[] descriptorRefs;
/**
- * Directory to scan for descriptor files in.
+ * Directory to scan for descriptor files in. <b>NOTE:</b> This may not work correctly with assembly components.
*
* @parameter
*/
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/mdo/component.mdo
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/mdo/component.mdo?rev=1000934&r1=1000933&r2=1000934&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/mdo/component.mdo (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/mdo/component.mdo Fri Sep 24 16:09:58 2010
@@ -55,6 +55,21 @@
<version>1.0.0+</version>
<fields>
<field>
+ <name>moduleSets</name>
+ <version>1.1.2+</version>
+ <association>
+ <type>ModuleSet</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <description>
+ <![CDATA[
+ Specifies which module files to include in the assembly. A moduleSet
+ is specified by providing one or more of <moduleSet>
+ subelements.
+ ]]>
+ </description>
+ </field>
+ <field>
<name>fileSets</name>
<version>1.0.0+</version>
<association>
@@ -652,6 +667,247 @@
</field>
</fields>
</class>
+ <class>
+ <name>ModuleSet</name>
+ <description>
+ <![CDATA[
+ A moduleSet represent one or more project <module> present inside
+ a project's pom.xml. This allows you to include sources or binaries
+ belonging to a project's <modules>.
+
+ <br/><b>NOTE:</b> When using <moduleSets> from the command-line, it
+ is required to pass first the package phase by doing: "mvn package
+ assembly:assembly". This bug/issue is scheduled to be addressed by Maven 2.1.
+ ]]>
+ </description>
+ <version>1.0.0+</version>
+ <fields>
+ <field>
+ <name>useAllReactorProjects</name>
+ <version>1.1.2+</version>
+ <type>boolean</type>
+ <defaultValue>false</defaultValue>
+ <description>
+ If set to true, the plugin will include all projects in the current reactor for processing
+ in this ModuleSet. These will be subject to include/exclude rules.
+ Default value is true. (Since 2.2-beta-6)
+ </description>
+ </field>
+ <field>
+ <name>includeSubModules</name>
+ <version>1.1.2+</version>
+ <type>boolean</type>
+ <defaultValue>true</defaultValue>
+ <description>
+ If set to false, the plugin will exclude sub-modules from processing in this ModuleSet.
+ Otherwise, it will process all sub-modules, each subject to include/exclude rules.
+ Default value is true. (Since 2.2)
+ </description>
+ </field>
+ <field>
+ <name>includes</name>
+ <version>1.1.2+</version>
+ <description>
+ <![CDATA[
+ This is a list of <include/> subelements, each containing a
+ module reference of the type groupId:artifactId. Modules matching
+ these elements will be included in this set. If none is present,
+ then <includes> represents all valid values.
+ ]]>
+ </description>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>excludes</name>
+ <version>1.1.2+</version>
+ <description>
+ <![CDATA[
+ This is a list of <exclude/> subelements, each containing a
+ module reference of the type groupId:artifactId. Modules matching
+ these elements will be excluded from this set.
+ ]]>
+ </description>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>sources</name>
+ <version>1.1.2+</version>
+ <description>
+ When this is present, the plugin will include the source files of
+ the included modules from this set in the resulting assembly.
+ </description>
+ <association>
+ <type>ModuleSources</type>
+ </association>
+ </field>
+ <field>
+ <name>binaries</name>
+ <version>1.1.2+</version>
+ <description>
+ When this is present, the plugin will include the binaries of the
+ included modules from this set in the resulting assembly.
+ </description>
+ <association>
+ <type>ModuleBinaries</type>
+ </association>
+ </field>
+ </fields>
+ </class>
+
+ <class>
+ <name>ModuleSources</name>
+ <version>1.1.2+</version>
+ <superClass>SetBase</superClass>
+ <description>
+ Contains configuration options for including the source files of a
+ project module in an assembly.
+ </description>
+ <fields>
+ <field>
+ <name>fileSets</name>
+ <version>1.1.2+</version>
+ <association>
+ <type>FileSet</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <description>
+ <![CDATA[
+ Specifies which groups of files from each included module to include in the assembly. A
+ fileSet is specified by providing one or more of <fileSet> subelements. (Since 2.2)
+ ]]>
+ </description>
+ </field>
+ <field>
+ <name>includeModuleDirectory</name>
+ <version>1.1.2+</version>
+ <type>boolean</type>
+ <defaultValue>true</defaultValue>
+ <description>
+ <![CDATA[
+ Specifies whether the module's finalName should be prepended to the outputDirectory
+ values of any fileSets applied to it. Default value is true. (Since 2.2)
+ ]]>
+ </description>
+ </field>
+ <field>
+ <name>excludeSubModuleDirectories</name>
+ <version>1.1.2+</version>
+ <type>boolean</type>
+ <defaultValue>true</defaultValue>
+ <description>
+ <![CDATA[
+ Specifies whether sub-module directories below the current module should be excluded
+ from fileSets applied to that module. This might be useful if you only mean to copy
+ the sources for the exact module list matched by this ModuleSet, ignoring (or processing
+ separately) the modules which exist in directories below the current one.
+ Default value is true. (Since 2.2)
+ ]]>
+ </description>
+ </field>
+ <field>
+ <name>outputDirectoryMapping</name>
+ <version>1.1.2+</version>
+ <type>String</type>
+ <defaultValue>${module.artifactId}</defaultValue>
+ <description>
+ Sets the mapping pattern for all module base-directories included in this assembly.
+ NOTE: This field is only used if includeModuleDirectory == true.
+ Default is the module's ${artifactId} in 2.2-beta-1, and ${module.artifactId} in subsequent versions. (Since 2.2)
+ </description>
+ </field>
+ </fields>
+ </class>
+
+ <class>
+ <name>ModuleBinaries</name>
+ <version>1.1.2+</version>
+ <superClass>SetBase</superClass>
+ <description>
+ Contains configuration options for including the binary files of a
+ project module in an assembly.
+ </description>
+ <fields>
+ <field>
+ <name>attachmentClassifier</name>
+ <version>1.1.2+</version>
+ <type>String</type>
+ <description>
+ When specified, the attachmentClassifier will cause the assembler to look at artifacts
+ attached to the module instead of the main project artifact. If it can find an attached
+ artifact matching the specified classifier, it will use it; otherwise, it will throw an
+ exception. (Since 2.2)
+ </description>
+ </field>
+ <field>
+ <name>includeDependencies</name>
+ <version>1.1.2+</version>
+ <type>boolean</type>
+ <defaultValue>true</defaultValue>
+ <description>
+ If set to true, the plugin will include the direct and transitive dependencies of
+ of the project modules included here. Otherwise, it will only include the module
+ packages only. Default value is true.
+ </description>
+ </field>
+ <field>
+ <name>dependencySets</name>
+ <version>1.1.2+</version>
+ <association>
+ <type>DependencySet</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <description>
+ <![CDATA[
+ Specifies which dependencies of the module to include in the assembly. A
+ dependencySet is specified by providing one or more of
+ <dependencySet> subelements. (Since 2.2)
+ ]]>
+ </description>
+ </field>
+ <field>
+ <name>unpack</name>
+ <version>1.1.2+</version>
+ <type>boolean</type>
+ <defaultValue>true</defaultValue>
+ <description>
+ If set to true, this property will unpack all module packages
+ into the specified output directory. When set to false
+ module packages will be included as archives (jars).
+ Default value is true.
+ </description>
+ </field>
+ <field>
+ <name>unpackOptions</name>
+ <version>1.1.2+</version>
+ <description>
+ Allows the specification of includes and excludes, along with filtering options, for items
+ unpacked from a module artifact. (Since 2.2)
+ </description>
+ <association>
+ <type>UnpackOptions</type>
+ </association>
+ </field>
+ <field>
+ <name>outputFileNameMapping</name>
+ <version>1.1.2+</version>
+ <type>String</type>
+ <defaultValue>${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}</defaultValue>
+ <description>
+ Sets the mapping pattern for all NON-UNPACKED dependencies included
+ in this assembly.
+ Default is ${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}.
+ (Since 2.2-beta-2; 2.2-beta-1 uses ${artifactId}-${version}${dashClassifier?}.${extension}) NOTE: If the
+ dependencySet specifies unpack == true, outputFileNameMapping WILL NOT BE USED; in these cases, use outputDirectory.
+ </description>
+ </field>
+ </fields>
+ </class>
</classes>
</model>
Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java?rev=1000934&r1=1000933&r2=1000934&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java Fri Sep 24 16:09:58 2010
@@ -92,12 +92,14 @@ public class DefaultAssemblyReaderTest
}
@Override
- public void tearDown() throws IOException
+ public void tearDown()
+ throws IOException
{
fileManager.cleanUp();
}
- public void testIncludeSiteInAssembly_ShouldFailIfSiteDirectoryNonExistent() throws IOException
+ public void testIncludeSiteInAssembly_ShouldFailIfSiteDirectoryNonExistent()
+ throws IOException
{
final File siteDir = File.createTempFile( "assembly-reader.", ".test" );
siteDir.delete();
@@ -504,7 +506,7 @@ public class DefaultAssemblyReaderTest
mockManager.replayAll();
- new DefaultAssemblyReader().mergeComponentsWithMainAssembly( assembly, configSource );
+ new DefaultAssemblyReader().mergeComponentsWithMainAssembly( assembly, null, configSource );
final List<FileSet> fileSets = assembly.getFileSets();
@@ -551,7 +553,7 @@ public class DefaultAssemblyReaderTest
mockManager.replayAll();
- final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", configSource );
+ final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", null, configSource );
assertEquals( assembly.getId(), result.getId() );
@@ -598,7 +600,7 @@ public class DefaultAssemblyReaderTest
mockManager.replayAll();
- final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", configSource );
+ final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", null, configSource );
assertEquals( assembly.getId(), result.getId() );
@@ -650,7 +652,7 @@ public class DefaultAssemblyReaderTest
mockManager.replayAll();
- final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", configSource );
+ final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", null, configSource );
assertEquals( assembly.getId(), result.getId() );
@@ -720,7 +722,7 @@ public class DefaultAssemblyReaderTest
mockManager.replayAll();
- final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", configSource );
+ final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", null, configSource );
assertEquals( assembly.getId(), result.getId() );
@@ -791,7 +793,7 @@ public class DefaultAssemblyReaderTest
mockManager.replayAll();
- final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", configSource );
+ final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", null, configSource );
assertEquals( assembly.getId(), result.getId() );
@@ -838,7 +840,7 @@ public class DefaultAssemblyReaderTest
mockManager.replayAll();
- final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", configSource );
+ final Assembly result = new DefaultAssemblyReader().readAssembly( sr, "testLocation", null, configSource );
assertEquals( "group-assembly", result.getId() );
@@ -1112,7 +1114,8 @@ public class DefaultAssemblyReaderTest
assertEquals( assembly2.getId(), result2.getId() );
}
- private List<String> writeAssembliesToFile( final List<Assembly> assemblies, final File dir ) throws IOException
+ private List<String> writeAssembliesToFile( final List<Assembly> assemblies, final File dir )
+ throws IOException
{
final List<String> files = new ArrayList<String>();