You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bi...@apache.org on 2011/11/29 01:56:10 UTC
svn commit: r1207724 - in /maven/plugins/trunk/maven-assembly-plugin/src:
it/projects/basic-features/formats-in-pom-win/
main/java/org/apache/maven/plugin/assembly/mojos/ main/mdo/
Author: bimargulies
Date: Tue Nov 29 00:56:09 2011
New Revision: 1207724
URL: http://svn.apache.org/viewvc?rev=1207724&view=rev
Log:
MASSEMBLY-581: Allow formats in configuration to override descriptor
Added:
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/
- copied from r1207683, maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/this & that/
Modified:
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/pom.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/verify.bsh
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/descriptor.mdo
Modified: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/pom.xml?rev=1207724&r1=1207683&r2=1207724&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/pom.xml (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/pom.xml Tue Nov 29 00:56:09 2011
@@ -1,38 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
+ <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>
- </parent>
-
- <groupId>test</groupId>
- <artifactId>parent</artifactId>
- <version>1</version>
-
- <name>Test</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <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>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <name>Test</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <descriptors>
+ <descriptor>src/main/assembly/src.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
Modified: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/verify.bsh?rev=1207724&r1=1207683&r2=1207724&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/verify.bsh (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats-in-pom-win/verify.bsh Tue Nov 29 00:56:09 2011
@@ -1 +1,2 @@
-return new java.io.File( basedir, "target/parent-1-src/src/main/assembly/src.xml" ).exists();
\ No newline at end of file
+return !new java.io.File( basedir, "target/parent-1-src/src/main/assembly/src.xml" ).exists() &&
+ new java.io.File( basedir, "target/parent-1-src.zip" ) .exists();
\ No newline at end of file
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=1207724&r1=1207723&r2=1207724&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 Tue Nov 29 00:56:09 2011
@@ -134,6 +134,22 @@ public abstract class AbstractAssemblyMo
* @required
*/
private File workDirectory;
+
+ /**
+ * @parameter
+ *
+ * Specifies the formats of the assembly.
+ * Multiple formats can be supplied and the Assembly Plugin will generate an archive for each desired formats.
+ * When deploying your project, all file formats specified will also be deployed. A format is specified by supplying one of the following
+ * values in a <format> subelement:
+ * <ul>
+ * <li><em>zip</em> - Creates a ZIP file format</li>
+ * <li><em>tar</em> - Creates a TAR format</li>
+ * <li><em>tar.gz</em> - Creates a gzip'd TAR format</li>
+ * <li><em>tar.bz2</em> - Creates a bzip'd TAR format</li>
+ * </ul>
+ */
+ private List<String> formats;
/**
* This is the artifact classifier to be used for the resultant assembly artifact. Normally, you would use the
@@ -413,8 +429,18 @@ public abstract class AbstractAssemblyMo
try
{
final String fullName = AssemblyFormatUtils.getDistributionName( assembly, this );
+
+ List<String> effectiveFormats = formats;
+ if ( effectiveFormats == null || effectiveFormats.size() == 0 )
+ {
+ effectiveFormats = assembly.getFormats();
+ }
+ if ( effectiveFormats == null || effectiveFormats.size() == 0 )
+ {
+ throw new MojoFailureException( "No formats specified in the execution parameters or the assembly descriptor.");
+ }
- for ( final String format : assembly.getFormats() )
+ for ( final String format : effectiveFormats )
{
final File destFile = assemblyArchiver.createArchive( assembly, fullName, format, this );
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/mdo/descriptor.mdo
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/mdo/descriptor.mdo?rev=1207724&r1=1207723&r2=1207724&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/mdo/descriptor.mdo (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/mdo/descriptor.mdo Tue Nov 29 00:56:09 2011
@@ -85,14 +85,20 @@
<field>
<name>formats</name>
<version>1.0.0+</version>
- <required>true</required>
+ <required>false</required>
<association>
<type>String</type>
<multiplicity>*</multiplicity>
</association>
<description>
<![CDATA[
- Specifies the formats of the assembly. Multiple formats can be
+ Specifies the formats of the assembly.
+
+ It is often better to specify the formats via the goal parameter rather
+ than here. For example, that allows different profiles to generate
+ different types of archives.
+
+ Multiple formats can be
supplied and the Assembly Plugin will generate an archive for each
desired formats. When deploying your project, all file formats
specified will also be deployed. A format is specified by supplying