Author: krosenvold
Date: Thu Nov 13 15:15:27 2014
New Revision: 1639362

URL: http://svn.apache.org/r1639362
Log:
[MASSEMBLY-732] Fixed missing interpolation bit on assembly basedir

Added:
    
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-732/verify.bsh
Modified:
    
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhase.java

Added: 
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-732/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-732/verify.bsh?rev=1639362&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-732/verify.bsh
 (added)
+++ 
maven/plugins/trunk/maven-assembly-plugin/src/it/projects/bugs/massembly-732/verify.bsh
 Thu Nov 13 15:15:27 2014
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.*;
+import java.net.*;
+import org.apache.commons.compress.archivers.zip.ZipFile;
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+
+
+
+boolean result = true;
+
+try
+{
+    File zipFile = new File( basedir, "target/project2-0.0.1-SNAPSHOT-bin.zip" 
);
+    
+    if ( !zipFile.exists() || zipFile.isDirectory() )
+    {
+        System.err.println( "zip-file is missing or a directory." );
+        result = false;
+    }
+    
+    ZipFile zf = new ZipFile( zipFile );
+
+    ZipArchiveEntry ze = zf.getEntry( 
"spring-0.0.1-SNAPSHOT/lib/project2-0.0.1-SNAPSHOT.jar" );
+    if ( ze == null )
+    {
+        System.err.println( "filename is incorrect" );
+        result = false;
+    }
+    zf.close();
+}
+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/phase/FileItemAssemblyPhase.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhase.java?rev=1639362&r1=1639361&r2=1639362&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhase.java
 (original)
+++ 
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhase.java
 Thu Nov 13 15:15:27 2014
@@ -19,6 +19,8 @@ package org.apache.maven.plugin.assembly
  * under the License.
  */
 
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.output.DeferredFileOutputStream;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
@@ -29,6 +31,7 @@ import org.apache.maven.plugin.assembly.
 import org.apache.maven.plugin.assembly.model.FileItem;
 import org.apache.maven.plugin.assembly.utils.AssemblyFormatUtils;
 import org.apache.maven.plugin.assembly.utils.TypeConversionUtils;
+import org.apache.maven.shared.utils.StringUtils;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.util.ArchiverAttributeUtils;
@@ -93,8 +96,16 @@ public class FileItemAssemblyPhase
                 destName = sourceName;
             }
 
+            final String outputDirectory1;
+            if (!StringUtils.isEmpty( assembly.getBaseDirectory()))
+            {
+                outputDirectory1  =  assembly.getBaseDirectory() +  
File.separator + fileItem.getOutputDirectory();
+            } else {
+                outputDirectory1 = fileItem.getOutputDirectory();
+            }
+
             final String outputDirectory =
-                AssemblyFormatUtils.getOutputDirectory( 
fileItem.getOutputDirectory(), configSource.getFinalName(), configSource,
+                AssemblyFormatUtils.getOutputDirectory( outputDirectory1, 
configSource.getFinalName(), configSource,
                                                         
AssemblyFormatUtils.moduleProjectInterpolator(
                                                             
configSource.getProject() ),
                                                         
AssemblyFormatUtils.artifactProjectInterpolator( null ) );


Reply via email to