maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1639022 - in /maven/plugins/trunk/maven-assembly-plugin: ./ src/it/projects/bugs/massembly-580/ src/it/projects/bugs/massembly-580/src/ src/it/projects/bugs/massembly-580/src/main/ src/it/projects/bugs/massembly-580/src/main/assembly/ src/...
Date Wed, 12 Nov 2014 20:03:49 GMT
Author: krosenvold
Date: Wed Nov 12 20:03:48 2014
New Revision: 1639022

URL: http://svn.apache.org/r1639022
Log:
[MASSEMBLY-580] Fix

Added:
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/pom.xml
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/src/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/src/main/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/src/main/assembly/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/src/main/assembly/release.xml
Modified:
    maven/plugins/trunk/maven-assembly-plugin/pom.xml
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java

Modified: maven/plugins/trunk/maven-assembly-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/pom.xml?rev=1639022&r1=1639021&r2=1639022&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-assembly-plugin/pom.xml Wed Nov 12 20:03:48 2014
@@ -125,7 +125,7 @@ under the License.
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-archiver</artifactId>
-      <version>2.8.2</version>
+      <version>2.8.3-SNAPSHOT</version>
       <exclusions>
         <exclusion>
           <groupId>org.codehaus.plexus</groupId>

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/pom.xml?rev=1639022&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/pom.xml Wed
Nov 12 20:03:48 2014
@@ -0,0 +1,49 @@
+<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>
+
+    <groupId>com.sulake.maven</groupId>
+    <artifactId>directory-mode-ignored</artifactId>
+    <version>10-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <!-- bunch of wars defined here, random commons artifact for testing -->
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.2.2</version>
+            <!--type>war</type-->
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>${testVersion}</version>
+                <configuration>
+                    <finalName>project-deploy</finalName>
+                    <appendAssemblyId>false</appendAssemblyId>
+                    <descriptors>
+                        <descriptor>src/main/assembly/release.xml</descriptor>
+                    </descriptors>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id> <!-- this is used for inheritance
merges -->
+                        <phase>package</phase> <!-- bind to the packaging
phase -->
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/src/main/assembly/release.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/src/main/assembly/release.xml?rev=1639022&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/src/main/assembly/release.xml
(added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-580/src/main/assembly/release.xml
Wed Nov 12 20:03:48 2014
@@ -0,0 +1,20 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    <id>release</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <dependencySets>
+        <dependencySet>
+            <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+            <outputDirectory>webapps</outputDirectory>
+            <useTransitiveDependencies>true</useTransitiveDependencies>
+            <unpack>false</unpack>
+            <scope>runtime</scope>
+            <fileMode>0644</fileMode>
+            <directoryMode>0750</directoryMode>
+        </dependencySet>
+    </dependencySets>
+</assembly>

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java?rev=1639022&r1=1639021&r2=1639022&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java
Wed Nov 12 20:03:48 2014
@@ -101,125 +101,136 @@ public class AddArtifactTask
                                                     artifactProjectInterpolator( project
) );
 
 
-        if ( unpack )
+        boolean fileModeSet = false;
+        boolean dirModeSet = false;
+
+        final int oldDirMode = archiver.getOverrideDirectoryMode();
+        final int oldFileMode = archiver.getOverrideFileMode();
+
+        if ( fileMode != -1 )
         {
-            String outputLocation = destDirectory;
+            archiver.setFileMode( fileMode );
+            fileModeSet = true;
+        }
 
-            if ( ( outputLocation.length() > 0 ) && !outputLocation.endsWith(
"/" ) )
+        if ( directoryMode != -1 )
+        {
+            archiver.setDirectoryMode( directoryMode );
+            dirModeSet = true;
+        }
+        try
+        {
+
+            if ( unpack )
             {
-                outputLocation += "/";
+                unpacked( archiver, destDirectory );
+            }
+            else
+            {
+                asFile( archiver, configSource, destDirectory );
+            }
+        }
+        finally
+        {
+            if ( dirModeSet )
+            {
+                archiver.setDirectoryMode( oldDirMode );
             }
 
-            String[] includesArray = TypeConversionUtils.toStringArray( includes );
-            if ( includesArray == null )
+            if ( fileModeSet )
             {
-                includesArray = DEFAULT_INCLUDES_ARRAY;
+                archiver.setFileMode( oldFileMode );
             }
-            final String[] excludesArray = TypeConversionUtils.toStringArray( excludes );
+        }
 
-            final int oldDirMode = archiver.getOverrideDirectoryMode();
-            final int oldFileMode = archiver.getOverrideFileMode();
+    }
 
-            boolean fileModeSet = false;
-            boolean dirModeSet = false;
+    private void asFile( Archiver archiver, AssemblerConfigurationSource configSource, String
destDirectory )
+        throws AssemblyFormattingException, ArchiveCreationException
+    {
+        final String tempMapping =
+            AssemblyFormatUtils.evaluateFileNameMapping( outputFileNameMapping, artifact,
configSource.getProject(),
+                                                         moduleArtifact, configSource,
+                                                         moduleProjectInterpolator( moduleProject
),
+                                                         artifactProjectInterpolator( project
) );
 
-            try
-            {
-                if ( fileMode != -1 )
-                {
-                    archiver.setFileMode( fileMode );
-                    fileModeSet = true;
-                }
+        final String outputLocation = destDirectory + tempMapping;
 
-                if ( directoryMode != -1 )
-                {
-                    archiver.setDirectoryMode( directoryMode );
-                    dirModeSet = true;
-                }
+        try
+        {
+            final File artifactFile = artifact.getFile();
 
-                final File artifactFile = artifact.getFile();
-                if ( artifactFile == null )
-                {
-                    logger.warn( "Skipping artifact: " + artifact.getId()
-                                    + "; it does not have an associated file or directory."
);
-                }
-                else if ( artifactFile.isDirectory() )
-                {
-                    logger.debug( "Adding artifact directory contents for: " + artifact +
" to: " + outputLocation );
+            logger.debug( "Adding artifact: " + artifact.getId() + " with file: " + artifactFile
+ " to assembly location: " + outputLocation + "." );
 
-                    DefaultFileSet fs = DefaultFileSet.fileSet( artifactFile);
-                    fs.setIncludes(includesArray);
-                    fs.setExcludes(excludesArray);
-                    fs.setPrefix( outputLocation);
-                    fs.setStreamTransformer(transformer);
-                    archiver.addFileSet(fs);
-                }
-                else
-                {
-                    logger.debug( "Unpacking artifact contents for: " + artifact + " to:
" + outputLocation );
-                    logger.debug( "includes:\n" + StringUtils.join( includesArray, "\n" )
+ "\n" );
-                    logger.debug( "excludes:\n"
-                                    + ( excludesArray == null ? "none" : StringUtils.join(
excludesArray, "\n" ) )
-                                    + "\n" );
-                    DefaultArchivedFileSet afs = DefaultArchivedFileSet.archivedFileSet(artifactFile);
-                    afs.setIncludes(includesArray);
-                    afs.setExcludes(excludesArray);
-                    afs.setPrefix(outputLocation);
-                    afs.setStreamTransformer(transformer);
-                    archiver.addArchivedFileSet( afs );
-                }
-            }
-            catch ( final ArchiverException e )
+            if ( fileMode != -1 )
             {
-                throw new ArchiveCreationException( "Error adding file-set for '" + artifact.getId()
+ "' to archive: "
-                                + e.getMessage(), e );
+                archiver.addFile( artifactFile, outputLocation, fileMode );
             }
-            finally
+            else
             {
-                if ( dirModeSet )
-                {
-                    archiver.setDirectoryMode( oldDirMode );
-                }
-
-                if ( fileModeSet )
-                {
-                    archiver.setFileMode( oldFileMode );
-                }
+                archiver.addFile( artifactFile, outputLocation );
             }
         }
-        else
+        catch ( final ArchiverException e )
         {
-            final String tempMapping =
-                AssemblyFormatUtils.evaluateFileNameMapping( outputFileNameMapping, artifact,
-                                                             configSource.getProject(), moduleArtifact,
configSource,
-                                                             moduleProjectInterpolator( moduleProject
),
-                                                             artifactProjectInterpolator(
project ) );
+            throw new ArchiveCreationException( "Error adding file '" + artifact.getId()
+ "' to archive: " + e.getMessage(), e );
+        }
+    }
 
+    private void unpacked( Archiver archiver, String destDirectory )
+        throws ArchiveCreationException
+    {
+        String outputLocation = destDirectory;
 
-            final String outputLocation = destDirectory + tempMapping;
+        if ( ( outputLocation.length() > 0 ) && !outputLocation.endsWith( "/"
) )
+        {
+            outputLocation += "/";
+        }
 
-            try
-            {
-                final File artifactFile = artifact.getFile();
+        String[] includesArray = TypeConversionUtils.toStringArray( includes );
+        if ( includesArray == null )
+        {
+            includesArray = DEFAULT_INCLUDES_ARRAY;
+        }
+        final String[] excludesArray = TypeConversionUtils.toStringArray( excludes );
 
-                logger.debug( "Adding artifact: " + artifact.getId() + " with file: " + artifactFile
-                                + " to assembly location: " + outputLocation + "." );
+        try  {
 
-                if ( fileMode != -1 )
-                {
-                    archiver.addFile( artifactFile, outputLocation, fileMode );
-                }
-                else
-                {
-                    archiver.addFile( artifactFile, outputLocation );
-                }
-            }
-            catch ( final ArchiverException e )
+            final File artifactFile = artifact.getFile();
+            if ( artifactFile == null )
             {
-                throw new ArchiveCreationException( "Error adding file '" + artifact.getId()
+ "' to archive: "
-                                + e.getMessage(), e );
+                logger.warn( "Skipping artifact: " + artifact.getId() + "; it does not have
an associated file or directory." );
+            }
+            else if ( artifactFile.isDirectory() )
+            {
+                logger.debug( "Adding artifact directory contents for: " + artifact + " to:
" + outputLocation );
+
+                DefaultFileSet fs = DefaultFileSet.fileSet( artifactFile );
+                fs.setIncludes( includesArray );
+                fs.setExcludes( excludesArray );
+                fs.setPrefix( outputLocation );
+                fs.setStreamTransformer( transformer );
+                archiver.addFileSet( fs );
+            }
+            else
+            {
+                logger.debug( "Unpacking artifact contents for: " + artifact + " to: " +
outputLocation );
+                logger.debug( "includes:\n" + StringUtils.join( includesArray, "\n" ) + "\n"
);
+                logger.debug( "excludes:\n" + ( excludesArray == null ? "none" : StringUtils.join(
excludesArray, "\n" ) )
+                                  + "\n" );
+                DefaultArchivedFileSet afs = DefaultArchivedFileSet.archivedFileSet( artifactFile
);
+                afs.setIncludes( includesArray );
+                afs.setExcludes( excludesArray );
+                afs.setPrefix( outputLocation );
+                afs.setStreamTransformer( transformer );
+                archiver.addArchivedFileSet( afs );
             }
         }
+        catch ( final ArchiverException e )
+        {
+            throw new ArchiveCreationException(
+                "Error adding file-set for '" + artifact.getId() + "' to archive: " + e.getMessage(),
e );
+        }
     }
 
     private File moveArtifactSomewhereElse(AssemblerConfigurationSource configSource) throws
ArchiveCreationException {



Mime
View raw message