You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2014/10/09 20:53:28 UTC
svn commit: r1630554 - in /maven/plugins/trunk/maven-assembly-plugin/src:
functional-tests/java/org/apache/maven/plugin/assembly/
functional-tests/plugin-configs/assembly/
functional-tests/resources/assemblies/ it/projects/basic-features/formats/
it/pr...
Author: krosenvold
Date: Thu Oct 9 18:53:27 2014
New Revision: 1630554
URL: http://svn.apache.org/r1630554
Log:
[MASSEMBLY-638] Support tgz and tbz2 format
Patch by Sergei Ivanov, slight adaptations to trunk by me
Added:
maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tbz2-plugin-config.xml
maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tgz-plugin-config.xml
maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tbz2.xml
maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tgz.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/TODO.txt
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/goals.txt
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/pom.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/src/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/src/assemblies/
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/src/assemblies/format-test.xml
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/verify.bsh
Modified:
maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.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/descriptor.mdo
maven/plugins/trunk/maven-assembly-plugin/src/site/apt/features.apt
maven/plugins/trunk/maven-assembly-plugin/src/site/apt/index.apt.vm
maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiverTest.java
Modified: maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java?rev=1630554&r1=1630553&r2=1630554&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/java/org/apache/maven/plugin/assembly/AssemblyMojoTest.java Thu Oct 9 18:53:27 2014
@@ -1248,6 +1248,20 @@ public class AssemblyMojoTest
assertTrue( "Test tar long file mode default", longFileMode.isWarnMode() );
}
+ public void testTgzArchive()
+ throws Exception
+ {
+ executeMojo( "tgz-plugin-config.xml" );
+
+ TarArchiver.TarCompressionMethod method = (TarArchiver.TarCompressionMethod) getVariableValueFromObject( ArchiverManagerStub.archiverStub, "tarCompressionMethod" );
+
+ assertEquals( "Test Tar compression method", "gzip", method.getValue() );
+
+ TarLongFileMode longFileMode = (TarLongFileMode) getVariableValueFromObject( ArchiverManagerStub.archiverStub, "longFileMode" );
+
+ assertTrue( "Test tar long file mode default", longFileMode.isWarnMode() );
+ }
+
public void testTarBzip2Archive()
throws Exception
{
@@ -1262,6 +1276,20 @@ public class AssemblyMojoTest
assertTrue( "Test tar long file mode default", longFileMode.isFailMode() );
}
+ public void testTbz2Archive()
+ throws Exception
+ {
+ executeMojo( "tbz2-plugin-config.xml" );
+
+ TarArchiver.TarCompressionMethod method = (TarArchiver.TarCompressionMethod) getVariableValueFromObject( ArchiverManagerStub.archiverStub, "tarCompressionMethod" );
+
+ assertEquals( "Test Tar compression method", "bzip2", method.getValue() );
+
+ TarLongFileMode longFileMode = (TarLongFileMode) getVariableValueFromObject( ArchiverManagerStub.archiverStub, "longFileMode" );
+
+ assertTrue( "Test tar long file mode default", longFileMode.isFailMode() );
+ }
+
public void testWarArchive()
throws Exception
{
Added: maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tbz2-plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tbz2-plugin-config.xml?rev=1630554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tbz2-plugin-config.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tbz2-plugin-config.xml Thu Oct 9 18:53:27 2014
@@ -0,0 +1,86 @@
+<!--
+ ~ Copyright 2001-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <outputDirectory>${basedir}/target/test-harness/assembly/tbz2/target</outputDirectory>
+ <finalName>assembly</finalName>
+ <workDirectory>${basedir}/target/test-harness/assembly/tbz2/work</workDirectory>
+ <archiverManager implementation="org.apache.maven.plugin.assembly.stubs.ArchiverManagerStub" />
+ <localRepository>${localRepository}</localRepository>
+ <reactorProjects></reactorProjects>
+ <classifier></classifier>
+ <project implementation="org.apache.maven.plugin.assembly.stubs.AssemblyMavenProjectStub" />
+ <executedProject implementation="org.apache.maven.plugin.assembly.stubs.AssemblyMavenProjectStub" />
+ <descriptor>${basedir}/src/test/resources/assemblies/tbz2.xml</descriptor>
+ <tarLongFileMode>fail</tarLongFileMode>
+ <basedir>${basedir}</basedir>
+ <tempRoot>${basedir}/target/test-harness/assembly/tbz2/archive-tmp</tempRoot>
+ <siteDirectory>${basedir}/target/test-harness/assembly/tbz2/site</siteDirectory>
+ <includeSite>false</includeSite>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+<!--
+ ~ Copyright 2001-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <outputDirectory>${basedir}/target/test-harness/assembly/tbz2/target</outputDirectory>
+ <finalName>assembly</finalName>
+ <workDirectory>${basedir}/target/test-harness/assembly/tbz2/work</workDirectory>
+ <archiverManager implementation="org.apache.maven.plugin.assembly.stubs.ArchiverManagerStub" />
+ <localRepository>${localRepository}</localRepository>
+ <reactorProjects></reactorProjects>
+ <classifier></classifier>
+ <project implementation="org.apache.maven.plugin.assembly.stubs.AssemblyMavenProjectStub" />
+ <executedProject implementation="org.apache.maven.plugin.assembly.stubs.AssemblyMavenProjectStub" />
+ <descriptor>${basedir}/src/test/resources/assemblies/tbz2.xml</descriptor>
+ <tarLongFileMode>fail</tarLongFileMode>
+ <basedir>${basedir}</basedir>
+ <tempRoot>${basedir}/target/test-harness/assembly/tbz2/archive-tmp</tempRoot>
+ <siteDirectory>${basedir}/target/test-harness/assembly/tbz2/site</siteDirectory>
+ <includeSite>false</includeSite>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tgz-plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tgz-plugin-config.xml?rev=1630554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tgz-plugin-config.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/plugin-configs/assembly/tgz-plugin-config.xml Thu Oct 9 18:53:27 2014
@@ -0,0 +1,43 @@
+<!--
+ ~ Copyright 2001-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <outputDirectory>${basedir}/target/test-harness/assembly/tgz/target</outputDirectory>
+ <finalName>assembly</finalName>
+ <workDirectory>${basedir}/target/test-harness/assembly/tgz/work</workDirectory>
+ <archiverManager implementation="org.apache.maven.plugin.assembly.stubs.ArchiverManagerStub" />
+ <localRepository>${localRepository}</localRepository>
+ <reactorProjects></reactorProjects>
+ <classifier></classifier>
+ <project implementation="org.apache.maven.plugin.assembly.stubs.AssemblyMavenProjectStub" />
+ <executedProject implementation="org.apache.maven.plugin.assembly.stubs.AssemblyMavenProjectStub" />
+ <descriptor>${basedir}/src/test/resources/assemblies/tgz.xml</descriptor>
+ <tarLongFileMode>warn</tarLongFileMode>
+ <basedir>${basedir}</basedir>
+ <tempRoot>${basedir}/target/test-harness/assembly/tgz/archive-tmp</tempRoot>
+ <siteDirectory>${basedir}/target/test-harness/assembly/tgz/site</siteDirectory>
+ <includeSite>false</includeSite>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tbz2.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tbz2.xml?rev=1630554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tbz2.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tbz2.xml Thu Oct 9 18:53:27 2014
@@ -0,0 +1,32 @@
+<!--
+ ~ Copyright 2001-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<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>simple</id>
+ <formats>
+ <format>tbz2</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>target/test-harness/assembly/tbz2/target</directory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
Added: maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tgz.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tgz.xml?rev=1630554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tgz.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/functional-tests/resources/assemblies/tgz.xml Thu Oct 9 18:53:27 2014
@@ -0,0 +1,32 @@
+<!--
+ ~ Copyright 2001-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<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>simple</id>
+ <formats>
+ <format>tgz</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>target/test-harness/assembly/tgz/target</directory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/TODO.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/TODO.txt?rev=1630554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/TODO.txt (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/TODO.txt Thu Oct 9 18:53:27 2014
@@ -0,0 +1 @@
+Test
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/goals.txt?rev=1630554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/goals.txt (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/goals.txt Thu Oct 9 18:53:27 2014
@@ -0,0 +1 @@
+clean org.apache.maven.plugins:maven-assembly-plugin:${testVersion}:single
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/pom.xml?rev=1630554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/pom.xml Thu Oct 9 18:53:27 2014
@@ -0,0 +1,31 @@
+<?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>
+ <version>1</version>
+ </parent>
+
+ <groupId>org.test</groupId>
+ <artifactId>format-test</artifactId>
+ <version>1.0</version>
+
+ <name>Test</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assemblies/format-test.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ <outputDirectory>${project.build.directory}/assemblies</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/src/assemblies/format-test.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/src/assemblies/format-test.xml?rev=1630554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/src/assemblies/format-test.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/src/assemblies/format-test.xml Thu Oct 9 18:53:27 2014
@@ -0,0 +1,24 @@
+<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>format-test</id>
+ <formats>
+ <format>dir</format>
+ <format>zip</format>
+ <format>tar</format>
+ <format>tar.gz</format>
+ <format>tgz</format>
+ <format>tar.bz2</format>
+ <format>tbz2</format>
+ <format>jar</format>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <files>
+ <file>
+ <source>TODO.txt</source>
+ <outputDirectory>/</outputDirectory>
+ </file>
+ </files>
+</assembly>
Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/verify.bsh?rev=1630554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/verify.bsh (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/formats/verify.bsh Thu Oct 9 18:53:27 2014
@@ -0,0 +1,116 @@
+import java.io.*;
+import java.net.*;
+import java.util.jar.*;
+
+boolean result = true;
+
+try
+{
+ File assembly = new File( basedir, "target/assemblies/format-test-1.0" );
+ result = result && assembly.exists();
+ result = result && assembly.isDirectory();
+ result = result && new File( assembly, "TODO.txt" ).exists();
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+try
+{
+ File assembly = new File( basedir, "target/assemblies/format-test-1.0.zip" );
+ result = result && assembly.exists();
+ result = result && assembly.isFile();
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+try
+{
+ File assembly = new File( basedir, "target/assemblies/format-test-1.0.tar" );
+ result = result && assembly.exists();
+ result = result && assembly.isFile();
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+try
+{
+ File assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.gz" );
+ result = result && assembly.exists();
+ result = result && assembly.isFile();
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+try
+{
+ File assembly = new File( basedir, "target/assemblies/format-test-1.0.tgz" );
+ result = result && assembly.exists();
+ result = result && assembly.isFile();
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+try
+{
+ File assembly = new File( basedir, "target/assemblies/format-test-1.0.tar.bz2" );
+ result = result && assembly.exists();
+ result = result && assembly.isFile();
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+try
+{
+ File assembly = new File( basedir, "target/assemblies/format-test-1.0.tbz2" );
+ result = result && assembly.exists();
+ result = result && assembly.isFile();
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+try
+{
+ File assembly = new File( basedir, "target/assemblies/format-test-1.0.jar" );
+ result = result && assembly.exists();
+ result = result && assembly.isFile();
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+try
+{
+ File assembly = new File( basedir, "target/assemblies/format-test-1.0.war" );
+ result = result && assembly.exists();
+ result = result && assembly.isFile();
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+return result;
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java?rev=1630554&r1=1630553&r2=1630554&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiver.java Thu Oct 9 18:53:27 2014
@@ -268,7 +268,7 @@ public class DefaultAssemblyArchiver
/**
* Creates the necessary archiver to build the distribution file.
- *
+ *
* @param format Archive format
* @param includeBaseDir
* @param finalName
@@ -286,7 +286,7 @@ public class DefaultAssemblyArchiver
throws ArchiverException, NoSuchArchiverException
{
Archiver archiver;
- if ( format.startsWith( "tar" ) )
+ if ( "tgz".equals( format ) || "tbz2".equals( format ) || format.startsWith( "tar" ) )
{
archiver = createTarArchiver( format, TarLongFileMode.valueOf( configSource.getTarLongFileMode()) );
}
@@ -509,6 +509,14 @@ public class DefaultAssemblyArchiver
}
tarArchiver.setCompression( tarCompressionMethod );
}
+ else if ( "tgz".equals( format ) )
+ {
+ tarArchiver.setCompression( TarArchiver.TarCompressionMethod.gzip );
+ }
+ else if ( "tbz2".equals( format ) )
+ {
+ tarArchiver.setCompression( TarArchiver.TarCompressionMethod.bzip2 );
+ }
tarArchiver.setLongfile( tarLongFileMode );
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=1630554&r1=1630553&r2=1630554&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 Oct 9 18:53:27 2014
@@ -136,8 +136,8 @@ public abstract class AbstractAssemblyMo
* <li><em>dir</em> - Creates a directory</li>
* <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>
+ * <li><em>tar.gz</em> or <em>tgz</em> - Creates a gzip'd TAR format</li>
+ * <li><em>tar.bz2</em> or <em>tbz2</em> - Creates a bzip'd TAR format</li>
* </ul>
*/
@Parameter
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=1630554&r1=1630553&r2=1630554&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 Thu Oct 9 18:53:27 2014
@@ -106,8 +106,8 @@
<ul>
<li><b>"zip"</b> - Creates a ZIP file format</li>
<li><b>"tar"</b> - Creates a TAR format</li>
- <li><b>"tar.gz"</b> - Creates a gzip'd TAR format</li>
- <li><b>"tar.bz2"</b> - Creates a bzip'd TAR format</li>
+ <li><b>"tar.gz"</b> or <b>"tgz"</b> - Creates a gzip'd TAR format</li>
+ <li><b>"tar.bz2"</b> or <b>"tbz2"</b> - Creates a bzip'd TAR format</li>
<li><b>"jar"</b> - Creates a JAR format</li>
<li><b>"dir"</b> - Creates an exploded directory format</li>
<li><b>"war"</b> - Creates a WAR format</li>
Modified: maven/plugins/trunk/maven-assembly-plugin/src/site/apt/features.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/site/apt/features.apt?rev=1630554&r1=1630553&r2=1630554&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/site/apt/features.apt (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/site/apt/features.apt Thu Oct 9 18:53:27 2014
@@ -46,7 +46,7 @@ Features
* Reusable assembly-descriptor components <[2.1]>
- * Supported archive formats include: zip, tar, tar.gz, tar.bz2, jar, dir, war
+ * Supported archive formats include: zip, tar, tar.gz (or tgz), tar.bz2 (or tbz2), jar, dir, war
(and any other format that the ArchiveManager has been configured for).
Modified: maven/plugins/trunk/maven-assembly-plugin/src/site/apt/index.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/site/apt/index.apt.vm?rev=1630554&r1=1630553&r2=1630554&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/site/apt/index.apt.vm (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/site/apt/index.apt.vm Thu Oct 9 18:53:27 2014
@@ -50,9 +50,9 @@ ${project.name}
* tar
- * tar.gz
+ * tar.gz (or tgz)
- * tar.bz2
+ * tar.bz2 (or tbz2)
* jar
Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiverTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiverTest.java?rev=1630554&r1=1630553&r2=1630554&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiverTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/DefaultAssemblyArchiverTest.java Thu Oct 9 18:53:27 2014
@@ -117,7 +117,7 @@ public class DefaultAssemblyArchiverTest
mm.replayAll();
final DefaultAssemblyArchiver archiver = createSubject( macMgr, null, null );
- archiver.createArchive( new Assembly(), "full-name", "zip", configSource, false);
+ archiver.createArchive( new Assembly(), "full-name", "zip", configSource, false );
mm.verifyAll();
}
@@ -213,7 +213,7 @@ public class DefaultAssemblyArchiverTest
final DefaultAssemblyArchiver subject = createSubject( macMgr, Collections.singletonList( phase ), null );
- subject.createArchive( assembly, "full-name", "zip", configSource, false);
+ subject.createArchive( assembly, "full-name", "zip", configSource, false );
mm.verifyAll();
}
@@ -276,7 +276,7 @@ public class DefaultAssemblyArchiverTest
final DefaultAssemblyArchiver subject =
createSubject( macArchiverManager, new ArrayList<AssemblyArchiverPhase>(), null );
- subject.createArchiver( "dummy", false, "finalName", configSource, null, false);
+ subject.createArchiver( "dummy", false, "finalName", configSource, null, false );
assertEquals( simpleConfig, archiver.getSimpleConfig() );
@@ -329,7 +329,7 @@ public class DefaultAssemblyArchiverTest
final DefaultAssemblyArchiver subject =
createSubject( macArchiverManager, new ArrayList<AssemblyArchiverPhase>(), null );
- subject.createArchiver( "tar", false, "finalName", configSource, null, false);
+ subject.createArchiver( "tar", false, "finalName", configSource, null, false );
assertNull( ttArchiver.compressionMethod );
assertEquals( TarLongFileMode.fail, ttArchiver.longFileMode );
@@ -383,7 +383,7 @@ public class DefaultAssemblyArchiverTest
final DefaultAssemblyArchiver subject =
createSubject( macArchiverManager, new ArrayList<AssemblyArchiverPhase>(), null );
- subject.createArchiver( "war", false, null, configSource, null, false);
+ subject.createArchiver( "war", false, null, configSource, null, false );
assertFalse( twArchiver.ignoreWebxml );
}
@@ -425,7 +425,7 @@ public class DefaultAssemblyArchiverTest
final DefaultAssemblyArchiver subject =
createSubject( macArchiverManager, new ArrayList<AssemblyArchiverPhase>(), null );
- subject.createArchiver( "zip", false, null, configSource, null, false);
+ subject.createArchiver( "zip", false, null, configSource, null, false );
}
// TODO: Re-implement these tests on the createArchiver(..) method. For now, they're no big loss.
@@ -580,7 +580,7 @@ public class DefaultAssemblyArchiverTest
}
@Test
- public void testCreateTarArchiver_ShouldInitializeGZipCompression()
+ public void testCreateTarArchiver_TarGzFormat_ShouldInitializeGZipCompression()
throws NoSuchArchiverException, ArchiverException
{
final MockManager mm = new MockManager();
@@ -605,7 +605,32 @@ public class DefaultAssemblyArchiverTest
}
@Test
- public void testCreateTarArchiver_ShouldInitializeBZipCompression()
+ public void testCreateTarArchiver_TgzFormat_ShouldInitializeGZipCompression()
+ throws NoSuchArchiverException, ArchiverException
+ {
+ final MockManager mm = new MockManager();
+
+ final TestTarArchiver ttArchiver = new TestTarArchiver();
+
+ final MockAndControlForAssemblyArchiver macArchiverManager = new MockAndControlForAssemblyArchiver( mm );
+
+ macArchiverManager.expectGetArchiver( "tar", ttArchiver );
+
+ mm.replayAll();
+
+ final DefaultAssemblyArchiver subject =
+ createSubject( macArchiverManager, new ArrayList<AssemblyArchiverPhase>(), null );
+
+ subject.createTarArchiver( "tgz", TarLongFileMode.fail );
+
+ assertEquals( TarArchiver.TarCompressionMethod.gzip, ttArchiver.compressionMethod );
+ assertEquals( TarLongFileMode.fail, ttArchiver.longFileMode );
+
+ mm.verifyAll();
+ }
+
+ @Test
+ public void testCreateTarArchiver_TarBz2Format_ShouldInitializeBZipCompression()
throws NoSuchArchiverException, ArchiverException
{
final MockManager mm = new MockManager();
@@ -630,7 +655,32 @@ public class DefaultAssemblyArchiverTest
}
@Test
- public void testCreateTarArchiver_ShouldFailWithInvalidCompression()
+ public void testCreateTarArchiver_Tbz2Format_ShouldInitializeBZipCompression()
+ throws NoSuchArchiverException, ArchiverException
+ {
+ final MockManager mm = new MockManager();
+
+ final TestTarArchiver ttArchiver = new TestTarArchiver();
+
+ final MockAndControlForAssemblyArchiver macArchiverManager = new MockAndControlForAssemblyArchiver( mm );
+
+ macArchiverManager.expectGetArchiver( "tar", ttArchiver );
+
+ mm.replayAll();
+
+ final DefaultAssemblyArchiver subject =
+ createSubject( macArchiverManager, new ArrayList<AssemblyArchiverPhase>(), null );
+
+ subject.createTarArchiver( "tbz2", TarLongFileMode.fail );
+
+ assertEquals( TarArchiver.TarCompressionMethod.bzip2, ttArchiver.compressionMethod );
+ assertEquals( TarLongFileMode.fail, ttArchiver.longFileMode );
+
+ mm.verifyAll();
+ }
+
+ @Test
+ public void testCreateTarArchiver_InvalidFormat_ShouldFailWithInvalidCompression()
throws NoSuchArchiverException, ArchiverException
{
final MockManager mm = new MockManager();