maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r694529 - in /maven/plugins/trunk/maven-assembly-plugin: ./ src/main/java/org/apache/maven/plugin/assembly/ src/main/java/org/apache/maven/plugin/assembly/archive/ src/main/java/org/apache/maven/plugin/assembly/archive/phase/ src/main/java/...
Date Thu, 11 Sep 2008 23:02:40 GMT
Author: jdcasey
Date: Thu Sep 11 16:02:34 2008
New Revision: 694529

URL: http://svn.apache.org/viewvc?rev=694529&view=rev
Log:
[MASSEMBLY-331] Fixing order of operations for expression interpolation in outputDirectory and outputFileNameMapping.

Submitted by: Petar Tahchiev

I added minor modifications.

Removed:
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/PrefixedObjectBasedValueSource.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/PrefixedPropertiesInterpolationValueSource.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/PropertiesInterpolationValueSource.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/AllTests.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/PropertiesInterpolationValueSourceTest.java
Modified:
    maven/plugins/trunk/maven-assembly-plugin/pom.xml
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.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/archive/phase/FileItemAssemblyPhase.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhase.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhase.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTask.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.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/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/PropertyUtils.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/DependencySetAssemblyPhaseTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhaseTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhaseTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhaseTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTaskTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTaskTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddArtifactTask.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddDependencySetsTask.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReaderTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtilsTest.java
    maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/PropertyUtilsTest.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=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-assembly-plugin/pom.xml Thu Sep 11 16:02:34 2008
@@ -159,8 +159,8 @@
     </dependency>
     <dependency>
       <groupId>easymock</groupId>
-      <artifactId>easymock</artifactId>
-      <version>1.2_Java1.3</version>
+      <artifactId>easymockclassextension</artifactId>
+      <version>1.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -187,6 +187,11 @@
       <version>3.8.1</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+    	<groupId>org.codehaus.plexus</groupId>
+    	<artifactId>plexus-interpolation</artifactId>
+    	<version>1.5</version>
+    </dependency>
   </dependencies>
 
   <repositories>
@@ -368,6 +373,8 @@
                   <pomExcludes>
                     <pomExclude>repositories/repo-with-snapshot-parents/pom.xml</pomExclude>
                     
+                    <!-- MASSEMBLY has NOT been fixed yet. -->
+                    <pomExclude>bugs/massembly-285/**</pomExclude>
                     <!-- This will be handled by the parent in the bugs/massembly-285 dir. -->
                     <pomExclude>bugs/massembly-285/massembly-285-*/pom.xml</pomExclude>
                     

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblerConfigurationSource.java Thu Sep 11 16:02:34 2008
@@ -21,6 +21,7 @@
 
 import org.apache.maven.archiver.MavenArchiveConfiguration;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
 
 import java.io.File;
@@ -81,4 +82,6 @@
     boolean isIgnoreDirFormatExtensions();
 
     boolean isIgnoreMissingDescriptor();
+    
+    MavenSession getMavenSession();
 }

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=694529&r1=694528&r2=694529&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 Sep 11 16:02:34 2008
@@ -112,7 +112,7 @@
             if ( specifiedBasedir != null )
             {
                 basedir = AssemblyFormatUtils.getOutputDirectory( specifiedBasedir, configSource.getProject(),
-                                                                  null, finalName );
+                                                                  null, finalName, configSource );
             }
 
             List containerHandlers = selectContainerDescriptorHandlers( assembly.getContainerDescriptorHandlers() );

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=694529&r1=694528&r2=694529&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 Sep 11 16:02:34 2008
@@ -80,8 +80,9 @@
                 destName = sourceName;
             }
 
-            String outputDirectory = AssemblyFormatUtils.getOutputDirectory( fileItem.getOutputDirectory(),
-                configSource.getProject(), null, configSource.getFinalName() );
+            String outputDirectory =
+                AssemblyFormatUtils.getOutputDirectory( fileItem.getOutputDirectory(), configSource.getProject(), null,
+                                                        configSource.getFinalName(), configSource );
 
             String target;
 

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhase.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhase.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhase.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhase.java Thu Sep 11 16:02:34 2008
@@ -431,7 +431,7 @@
         {
             destPathPrefix =
                 AssemblyFormatUtils.evaluateFileNameMapping( sources.getOutputDirectoryMapping(),
-                                                             moduleProject.getArtifact(), configSource.getProject(), moduleProject, "module." );
+                                                             moduleProject.getArtifact(), configSource.getProject(), moduleProject, "module.", configSource );
 
             if ( !destPathPrefix.endsWith( "/" ) )
             {
@@ -450,7 +450,9 @@
             destPath = destPathPrefix + destPath;
         }
 
-        destPath = AssemblyFormatUtils.getOutputDirectory( destPath, configSource.getProject(), moduleProject, configSource.getFinalName(), "module." );
+        destPath =
+            AssemblyFormatUtils.getOutputDirectory( destPath, configSource.getProject(), moduleProject,
+                                                    configSource.getFinalName(), "module.", configSource );
 
         fs.setOutputDirectory( destPath );
 

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhase.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhase.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhase.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhase.java Thu Sep 11 16:02:34 2008
@@ -95,7 +95,8 @@
 
             String outputDirectory =
                 AssemblyFormatUtils.getOutputDirectory( repository.getOutputDirectory(), configSource.getProject(),
-                                                        null, configSource.getFinalName() );
+                                                        null, configSource.getFinalName(),
+                                                        configSource );
 
             File repositoryDirectory = new File( tempRoot, outputDirectory );
 

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=694529&r1=694528&r2=694529&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 Thu Sep 11 16:02:34 2008
@@ -101,7 +101,7 @@
 
         String destDirectory = outputDirectory;
 
-        destDirectory = AssemblyFormatUtils.getOutputDirectory( destDirectory, configSource.getProject(), project, configSource.getFinalName(), artifactExpressionPrefix );
+        destDirectory = AssemblyFormatUtils.getOutputDirectory( destDirectory, configSource.getProject(), project, configSource.getFinalName(), artifactExpressionPrefix, configSource );
 
         if ( unpack )
         {
@@ -167,7 +167,10 @@
         }
         else
         {
-            String fileNameMapping = AssemblyFormatUtils.evaluateFileNameMapping( outputFileNameMapping, artifact, configSource.getProject(), project, artifactExpressionPrefix );
+            String fileNameMapping = AssemblyFormatUtils.evaluateFileNameMapping( outputFileNameMapping, artifact, 
+            		                                                              configSource.getProject(), project, 
+            		                                                              artifactExpressionPrefix,
+            		                                                              configSource );
 
             String outputLocation = destDirectory + fileNameMapping;
 

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java Thu Sep 11 16:02:34 2008
@@ -286,11 +286,13 @@
 
         outputDirectory = AssemblyFormatUtils.getOutputDirectory( outputDirectory, configSource.getProject(),
                                                                   depProject, depProject.getBuild().getFinalName(),
-                                                                  artifactExpressionPrefix );
+                                                                  artifactExpressionPrefix,
+                                                                  configSource );
 
         String destName = AssemblyFormatUtils.evaluateFileNameMapping( dependencySet.getOutputFileNameMapping(),
                                                                        depArtifact, configSource.getProject(),
-                                                                       depProject, artifactExpressionPrefix );
+                                                                       depProject, artifactExpressionPrefix,
+                                                                       configSource );
 
         String target;
 

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java Thu Sep 11 16:02:34 2008
@@ -111,7 +111,9 @@
             destDirectory = fileSet.getDirectory();
         }
 
-        destDirectory = AssemblyFormatUtils.getOutputDirectory( destDirectory, configSource.getProject(), project, configSource.getFinalName(), artifactExpressionPrefix );
+        destDirectory =
+            AssemblyFormatUtils.getOutputDirectory( destDirectory, configSource.getProject(), project,
+                                                    configSource.getFinalName(), artifactExpressionPrefix, configSource );
 
         if ( logger.isDebugEnabled() )
         {
@@ -127,7 +129,6 @@
 
         if ( fileSetDir.exists() )
         {
-            File origFileSetDir = fileSetDir;
             try
             {
                 fileSetDir = fileSetFormatter.formatFileSetForAssembly( fileSetDir, fileSet );

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=694529&r1=694528&r2=694529&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 Thu Sep 11 16:02:34 2008
@@ -236,7 +236,7 @@
     private Assembly addAssemblyForDescriptorReference( String ref, AssemblerConfigurationSource configSource, List assemblies )
         throws AssemblyReadException, InvalidAssemblerConfigurationException
     {
-        InputStream resourceAsStream = getClass().getResourceAsStream( "/assemblies/" + ref + ".xml" );
+        InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream( "assemblies/" + ref + ".xml" );
 
         if ( resourceAsStream == null )
         {

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=694529&r1=694528&r2=694529&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 Sep 11 16:02:34 2008
@@ -21,6 +21,7 @@
 
 import org.apache.maven.archiver.MavenArchiveConfiguration;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -204,6 +205,15 @@
      * @component
      */
     private MavenProjectHelper projectHelper;
+    
+    /**
+     * The Maven Session Object
+     *
+     * @parameter expression="${session}"
+     * @required
+     * @readonly
+     */
+    private MavenSession mavenSession;
 
     /**
      * Temporary directory that contain the files to be assembled.
@@ -638,4 +648,9 @@
     public void setIgnoreMissingDescriptor(boolean ignoreMissingDescriptor) {
         this.ignoreMissingDescriptor = ignoreMissingDescriptor;
     }
+    
+    public MavenSession getMavenSession() {
+    	return this.mavenSession;
+    }
+
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java Thu Sep 11 16:02:34 2008
@@ -19,23 +19,50 @@
  * under the License.
  */
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugin.assembly.model.Assembly;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.PrefixedObjectValueSource;
+import org.codehaus.plexus.interpolation.PrefixedPropertiesValueSource;
+import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
+import org.codehaus.plexus.interpolation.StringSearchInterpolator;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.interpolation.ObjectBasedValueSource;
-import org.codehaus.plexus.util.interpolation.RegexBasedInterpolator;
-
-import java.io.IOException;
-import java.util.Properties;
 
 /**
  * @version $Id$
  */
 public final class AssemblyFormatUtils
 {
+    
+    private static final List PROJECT_PREFIXES;
+    
+    private static final List PROJECT_PROPERTIES_PREFIXES;
+    
+    static
+    {
+        List projectPrefixes = new ArrayList();
+        projectPrefixes.add( "pom." );
+        projectPrefixes.add( "project." );
+        
+        PROJECT_PREFIXES = Collections.unmodifiableList( projectPrefixes );
+        
+        List projectPropertiesPrefixes = new ArrayList();
+        
+        projectPropertiesPrefixes.add( "pom.properties." );
+        projectPropertiesPrefixes.add( "project.properties." );
+        
+        PROJECT_PROPERTIES_PREFIXES = Collections.unmodifiableList( projectPropertiesPrefixes );
+    }
 
     private AssemblyFormatUtils()
     {
@@ -70,31 +97,31 @@
     }
 
     public static String getOutputDirectory( String output, MavenProject mainProject, MavenProject artifactProject,
-                                             String finalName )
+                                             String finalName, AssemblerConfigurationSource configSource )
         throws AssemblyFormattingException
     {
-        return getOutputDirectory( output, mainProject, artifactProject, finalName, "artifact." );
+        return getOutputDirectory( output, mainProject, artifactProject, finalName, "artifact.", configSource );
     }
 
     /*
      * ORDER OF INTERPOLATION PRECEDENCE:
      *
-     * 1. Support for special expressions, like ${dashClassifier?}
-     * 2. prefixed with artifactProjectRefName, from parameters list above.
+     * 1. Support for special expressions, like ${finalName} (use the assembly plugin configuration not the build config)
+     * 2. prefixed with artifactProjectRefName ("module." or "artifact.", normally).
      *    A. MavenProject instance for artifact
      * 3. prefixed with "artifact.", if artifactProjectRefName != "artifact."
      *    A. MavenProject instance for artifact
-     * 4. prefixed with "pom."
-     *    A. MavenProject instance from current build
-     * 5. no prefix, using main project instance
+     * 4. user-defined properties from the command line
+     * 5. prefixed with "pom." or "project.", or no prefix at all
      *    A. MavenProject instance from current build
-     * 6. properties of the main project
-     * 7. System properties
+     * 6. properties from main project
+     * 7. system properties, from the MavenSession instance (to support IDEs)
      * 8. environment variables.
-     *
+     * 
      */
     public static String getOutputDirectory( String output, MavenProject mainProject, MavenProject artifactProject,
-                                             String finalName, String artifactProjectRefName )
+                                             String finalName, String artifactProjectRefName,
+                                             AssemblerConfigurationSource configSource )
         throws AssemblyFormattingException
     {
         if ( artifactProjectRefName == null )
@@ -102,11 +129,6 @@
             artifactProjectRefName = "artifact.";
         }
 
-        if ( !artifactProjectRefName.endsWith( "." ) )
-        {
-            artifactProjectRefName += ".";
-        }
-
         String value = output;
         if ( value == null )
         {
@@ -118,7 +140,7 @@
             artifactProjectRefName += ".";
         }
 
-        RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
+        StringSearchInterpolator interpolator = new StringSearchInterpolator();
 
         Properties specialExpressionOverrides = new Properties();
 
@@ -128,48 +150,86 @@
             specialExpressionOverrides.setProperty( "build.finalName", finalName );
         }
 
-        interpolator.addValueSource( new PropertiesInterpolationValueSource( specialExpressionOverrides ) );
-
-        if ( mainProject != null )
-        {
-            interpolator.addValueSource( new PrefixedObjectBasedValueSource( "pom.", mainProject ) );
-            interpolator.addValueSource( new PrefixedObjectBasedValueSource( "project.", mainProject ) );
-        }
+        // 1
+        interpolator.addValueSource( new PropertiesBasedValueSource( specialExpressionOverrides ) );
 
         if ( artifactProject != null )
         {
-            interpolator.addValueSource( new PrefixedObjectBasedValueSource( artifactProjectRefName, artifactProject ) );
+            // 2
+            interpolator.addValueSource( new PrefixedObjectValueSource( artifactProjectRefName, artifactProject ) );
 
             if ( !"artifact.".equals( artifactProjectRefName ) )
             {
-                interpolator.addValueSource( new PrefixedObjectBasedValueSource( "artifact.", artifactProject ) );
+                // 3
+                interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject ) );
             }
         }
 
+        MavenSession session = configSource.getMavenSession();
+
+        if ( session != null )
+        {
+            Properties userProperties = null;
+            try
+            {
+                userProperties = session.getExecutionProperties();
+            }
+            catch ( NoSuchMethodError nsmer )
+            {
+                // OK, so user is using Maven <= 2.0.8. No big deal.
+            }
+            
+            if ( userProperties != null )
+            {
+                // 4
+                interpolator.addValueSource( new PropertiesBasedValueSource( userProperties ) );
+            }
+        }
+        
         if ( mainProject != null )
         {
-            interpolator.addValueSource( new ObjectBasedValueSource( mainProject ) );
-
+            // 5
+            interpolator.addValueSource( new PrefixedObjectValueSource( PROJECT_PREFIXES, mainProject, true ) );
+            
             // 6
-            interpolator.addValueSource( new PropertiesInterpolationValueSource( mainProject.getProperties() ) );
-            interpolator.addValueSource( new PrefixedPropertiesInterpolationValueSource( "pom.properties.", mainProject.getProperties() ) );
-            interpolator.addValueSource( new PrefixedPropertiesInterpolationValueSource( "project.properties.", mainProject.getProperties() ) );
+            interpolator.addValueSource( new PrefixedPropertiesValueSource( PROJECT_PROPERTIES_PREFIXES, mainProject.getProperties(), true ) );
         }
 
+        Properties commandLineProperties = System.getProperties();
+        try
+        {
+            if ( session != null )
+            {
+                commandLineProperties = session.getExecutionProperties();
+            }
+
+        }
+        catch ( NoSuchMethodError nsmer )
+        {
+            // OK, so user is using Maven <= 2.0.8. No big deal.
+        }
+        
         // 7
-        interpolator.addValueSource( new PropertiesInterpolationValueSource( System.getProperties() ) );
+        interpolator.addValueSource( new PropertiesBasedValueSource( commandLineProperties ) );
 
         try
         {
             // 8
-            interpolator.addValueSource( new PropertiesInterpolationValueSource( CommandLineUtils.getSystemEnvVars( false ) ) );
+            interpolator.addValueSource( new PrefixedPropertiesValueSource( Collections.singletonList( "env." ), CommandLineUtils.getSystemEnvVars( false ), true ) );
         }
         catch ( IOException e )
         {
             throw new AssemblyFormattingException( "Failed to retrieve OS environment variables. Reason: " + e.getMessage(), e );
         }
 
-        value = interpolator.interpolate( value, "__project" );
+        try
+        {
+            value = interpolator.interpolate( value );
+        }
+        catch ( InterpolationException e )
+        {
+            throw new AssemblyFormattingException( "Failed to interpolate output directory. Reason: " + e.getMessage(), e );
+        }
 
         if ( ( value.length() > 0 ) && !value.endsWith( "/" ) && !value.endsWith( "\\" ) )
         {
@@ -187,10 +247,12 @@
         return value;
     }
 
-    public static String evaluateFileNameMapping( String expression, Artifact artifact, MavenProject mainProject, MavenProject artifactProject )
+    public static String evaluateFileNameMapping( String expression, Artifact artifact, MavenProject mainProject,
+                                                  MavenProject artifactProject,
+                                                  AssemblerConfigurationSource configSource )
         throws AssemblyFormattingException
     {
-        return evaluateFileNameMapping( expression, artifact, mainProject, artifactProject, "artifact." );
+        return evaluateFileNameMapping( expression, artifact, mainProject, artifactProject, "artifact.", configSource );
     }
 
     /*
@@ -204,17 +266,20 @@
      *    A. Artifact instance
      *    B. ArtifactHandler instance for artifact
      *    C. MavenProject instance for artifact
-     * 3. prefixed with "pom."
+     * 3. prefixed with "pom." or "project."
      *    A. MavenProject instance from current build
      * 4. no prefix, using main project instance
      *    A. MavenProject instance from current build
      * 5. Support for special expressions, like ${dashClassifier?}
-     * 6. properties from main project
-     * 7. System properties
-     * 8. environment variables.
+     * 6. user-defined properties from the command line
+     * 7. properties from main project
+     * 8. system properties, from the MavenSession instance (to support IDEs)
+     * 9. environment variables.
      *
      */
-    public static String evaluateFileNameMapping( String expression, Artifact artifact, MavenProject mainProject, MavenProject artifactProject, String artifactProjectRefName )
+    public static String evaluateFileNameMapping( String expression, Artifact artifact, MavenProject mainProject,
+                                                  MavenProject artifactProject, String artifactProjectRefName,
+                                                  AssemblerConfigurationSource configSource )
         throws AssemblyFormattingException
     {
         String value = expression;
@@ -233,14 +298,14 @@
         // [jdcasey; 16-Aug-1007] This is fixed in SVN, just waiting for it to pass out of legacy.
         artifact.isSnapshot();
 
-        RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
+        StringSearchInterpolator interpolator = new StringSearchInterpolator();
 
         // 1A
-        interpolator.addValueSource( new PrefixedObjectBasedValueSource( artifactProjectRefName, artifact ) );
+        interpolator.addValueSource( new PrefixedObjectValueSource( artifactProjectRefName, artifact ) );
 
         // 1B
-        interpolator.addValueSource( new PrefixedObjectBasedValueSource( artifactProjectRefName, artifact.getArtifactHandler() ) );
-        interpolator.addValueSource( new PrefixedObjectBasedValueSource( artifactProjectRefName
+        interpolator.addValueSource( new PrefixedObjectValueSource( artifactProjectRefName, artifact.getArtifactHandler() ) );
+        interpolator.addValueSource( new PrefixedObjectValueSource( artifactProjectRefName
                                                                          + ( artifactProjectRefName.endsWith( "." )
                                                                                          ? "" : "." ) + "handler.",
                                                                          artifact.getArtifactHandler() ) );
@@ -248,33 +313,30 @@
         // 1C
         if ( artifactProject != null )
         {
-            interpolator.addValueSource( new PrefixedObjectBasedValueSource( artifactProjectRefName, artifactProject ) );
+            interpolator.addValueSource( new PrefixedObjectValueSource( artifactProjectRefName, artifactProject ) );
         }
 
         if ( !"artifact.".equals( artifactProjectRefName ) )
         {
             // 2A
-            interpolator.addValueSource( new PrefixedObjectBasedValueSource( "artifact.", artifact ) );
+            interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifact ) );
 
             // 2B
-            interpolator.addValueSource( new PrefixedObjectBasedValueSource( "artifact.", artifact.getArtifactHandler() ) );
-            interpolator.addValueSource( new PrefixedObjectBasedValueSource( "artifact.handler.", artifact.getArtifactHandler() ) );
+            interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifact.getArtifactHandler() ) );
+            interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.handler.", artifact.getArtifactHandler() ) );
 
             // 2C
             if ( artifactProject != null )
             {
-                interpolator.addValueSource( new PrefixedObjectBasedValueSource( "artifact.", artifactProject ) );
+                interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject ) );
             }
         }
 
         if ( mainProject != null )
         {
             // 3
-            interpolator.addValueSource( new PrefixedObjectBasedValueSource( "pom.", mainProject ) );
-            interpolator.addValueSource( new PrefixedObjectBasedValueSource( "project.", mainProject ) );
-
             // 4
-            interpolator.addValueSource( new ObjectBasedValueSource( mainProject ) );
+            interpolator.addValueSource( new PrefixedObjectValueSource( PROJECT_PREFIXES, mainProject, true ) );
         }
 
         Properties specialRules = new Properties();
@@ -292,31 +354,70 @@
         }
 
         // 5
-        interpolator.addValueSource( new PropertiesInterpolationValueSource( specialRules ) );
+        interpolator.addValueSource( new PropertiesBasedValueSource( specialRules ) );
+
+        MavenSession session = configSource.getMavenSession();
 
+        if ( session != null )
+        {
+            Properties userProperties = null;
+            try
+            {
+                userProperties = session.getExecutionProperties();
+            }
+            catch ( NoSuchMethodError nsmer )
+            {
+                // OK, so user is using Maven <= 2.0.8. No big deal.
+            }
+            
+            if ( userProperties != null )
+            {
+                // 6
+                interpolator.addValueSource( new PropertiesBasedValueSource( userProperties ) );
+            }
+        }
+        
         if ( mainProject != null )
         {
-            // 6
-            interpolator.addValueSource( new PropertiesInterpolationValueSource( mainProject.getProperties() ) );
-            interpolator.addValueSource( new PrefixedPropertiesInterpolationValueSource( "pom.properties.", mainProject.getProperties() ) );
-            interpolator.addValueSource( new PrefixedPropertiesInterpolationValueSource( "project.properties.", mainProject.getProperties() ) );
+            // 7
+            interpolator.addValueSource( new PrefixedPropertiesValueSource( PROJECT_PROPERTIES_PREFIXES, mainProject.getProperties(), true ) );
         }
 
-        // 7
-        interpolator.addValueSource( new PropertiesInterpolationValueSource( System.getProperties() ) );
+        Properties commandLineProperties = System.getProperties();
+        try
+        {
+            if ( session != null )
+            {
+                commandLineProperties = session.getExecutionProperties();
+            }
+
+        }
+        catch ( NoSuchMethodError nsmer )
+        {
+            // OK, so user is using Maven <= 2.0.8. No big deal.
+        }
+        
+        // 8
+        interpolator.addValueSource( new PropertiesBasedValueSource( commandLineProperties ) );
 
         try
         {
-            // 8
-            interpolator.addValueSource( new PropertiesInterpolationValueSource( CommandLineUtils.getSystemEnvVars( false ) ) );
+            // 9
+            interpolator.addValueSource( new PrefixedPropertiesValueSource( Collections.singletonList( "env." ), CommandLineUtils.getSystemEnvVars( false ), true ) );
         }
         catch ( IOException e )
         {
             throw new AssemblyFormattingException( "Failed to retrieve OS environment variables. Reason: " + e.getMessage(), e );
         }
 
-        // Now, run the interpolation using the rules stated above.
-        value = interpolator.interpolate( value, "__artifact" );
+        try
+        {
+            value = interpolator.interpolate( value );
+        }
+        catch ( InterpolationException e )
+        {
+            throw new AssemblyFormattingException( "Failed to interpolate output filename mapping. Reason: " + e.getMessage(), e );
+        }
 
         value = StringUtils.replace( value, "//", "/" );
         value = StringUtils.replace( value, "\\\\", "\\" );

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/PropertyUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/PropertyUtils.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/PropertyUtils.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/PropertyUtils.java Thu Sep 11 16:02:34 2008
@@ -19,6 +19,10 @@
  * under the License.
  */
 
+import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
+import org.codehaus.plexus.interpolation.StringSearchInterpolator;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.interpolation.RegexBasedInterpolator;
 
@@ -50,7 +54,7 @@
      * @return the loaded and fully resolved Properties object
      */
     public static Properties getInterpolatedPropertiesFromFile( File propfile, boolean fail, boolean useSystemProps )
-        throws IOException
+        throws IOException, AssemblyFormattingException
     {
         Properties props;
 
@@ -80,13 +84,21 @@
             throw new FileNotFoundException( propfile.toString() );
         }
 
-        RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
-        interpolator.addValueSource( new PropertiesInterpolationValueSource( props ) );
+        StringSearchInterpolator interpolator = new StringSearchInterpolator();
+        interpolator.addValueSource( new PropertiesBasedValueSource( props ) );
 
         for ( Enumeration n = props.propertyNames(); n.hasMoreElements(); )
         {
             String key = (String) n.nextElement();
-            String value = interpolator.interpolate( props.getProperty( key ), "__properties" );
+            String value = props.getProperty( key );
+            try
+            {
+                value = interpolator.interpolate( value );
+            }
+            catch ( InterpolationException e )
+            {
+                throw new AssemblyFormattingException( "Failed to interpolate property value: '" + value + "' for key: '" + key + "'. Reason: " + e.getMessage(), e );
+            }
 
             props.setProperty( key, value );
         }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/DependencySetAssemblyPhaseTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/DependencySetAssemblyPhaseTest.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/DependencySetAssemblyPhaseTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/DependencySetAssemblyPhaseTest.java Thu Sep 11 16:02:34 2008
@@ -85,6 +85,8 @@
         macTask.expectGetDestFile( new File( "junk" ) );
         macTask.expectAddFile( artifactFile, "out/dep", 10 );
 
+        macTask.expectGetSession( null );
+        
         project.setArtifacts( Collections.singleton( artifactMock.getArtifact() ) );
 
         macTask.expectCSGetFinalName( "final-name" );

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhaseTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhaseTest.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhaseTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/FileItemAssemblyPhaseTest.java Thu Sep 11 16:02:34 2008
@@ -420,6 +420,9 @@
             mockManager.add( control );
 
             configSource = ( AssemblerConfigurationSource ) control.getMock();
+            
+            configSource.getMavenSession();
+            control.setReturnValue( null, MockControl.ZERO_OR_MORE );
         }
 
         public void expectGetProject( MavenProject project )

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhaseTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhaseTest.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhaseTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/ModuleSetAssemblyPhaseTest.java Thu Sep 11 16:02:34 2008
@@ -172,7 +172,7 @@
         MockAndControlForAddArtifactTask macTask = new MockAndControlForAddArtifactTask( mm, project );
 
         macTask.expectGetFinalName( null );
-
+        
         FileSet fs = new FileSet();
         fs.setOutputDirectory( "out" );
 
@@ -209,7 +209,7 @@
         MockAndControlForAddArtifactTask macTask = new MockAndControlForAddArtifactTask( mm, null );
 
         macTask.expectGetFinalName( null );
-
+        
         FileSet fs = new FileSet();
 
         ModuleSources sources = new ModuleSources();
@@ -275,7 +275,7 @@
         macTask.expectGetReactorProjects( projects );
         macTask.expectGetFinalName( "final-name" );
         macTask.expectGetDestFile( new File( "junk" ) );
-
+        
         int mode = TypeConversionUtils.modeToInt( "777", new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
 
         macTask.expectAddFile( moduleArtifactFile, "out/artifact", mode );
@@ -358,7 +358,7 @@
         macTask.expectGetFinalName( "final-name" );
         macTask.expectGetDestFile( new File( "junk" ) );
         macTask.expectAddFile( artifactFile, "out/artifact", TypeConversionUtils.modeToInt( "777", new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ) );
-
+        
         ModuleBinaries binaries = new ModuleBinaries();
 
         binaries.setIncludeDependencies( false );
@@ -437,7 +437,7 @@
         macTask.expectGetFinalName( "final-name" );
         macTask.expectGetDestFile( new File( "junk" ) );
         macTask.expectAddFile( artifactFile, "out/artifact", TypeConversionUtils.modeToInt( "777", new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ) );
-
+        
         ModuleBinaries binaries = new ModuleBinaries();
 
         binaries.setIncludeDependencies( false );
@@ -474,7 +474,8 @@
         macTask.expectCSGetFinalName( "final-name" );
         macTask.expectGetDestFile( new File( "junk" ) );
         macTask.expectAddFile( artifactFile, "out/artifact", TypeConversionUtils.modeToInt( "777", new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ) );
-
+        macTask.expectGetSession( null );
+        
         ModuleBinaries binaries = new ModuleBinaries();
 
         binaries.setUnpack( false );
@@ -536,7 +537,8 @@
         int mode = TypeConversionUtils.modeToInt( "777", new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
 
         macTask.expectAddFile( moduleArtifactFile, "out/artifact", mode );
-
+        macTask.expectGetSession( null );
+        
         ModuleBinaries binaries = new ModuleBinaries();
 
         binaries.setUnpack( false );
@@ -657,7 +659,7 @@
         macTask.expectGetDestFile( new File( "junk" ) );
 
         macTask.expectAddFile( artifactFile, "out/artifact", TypeConversionUtils.modeToInt( "777", new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ) );
-
+        
         ModuleBinaries binaries = new ModuleBinaries();
         binaries.setOutputDirectory( "out" );
         binaries.setOutputFileNameMapping( "artifact" );

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhaseTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhaseTest.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhaseTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/phase/RepositoryAssemblyPhaseTest.java Thu Sep 11 16:02:34 2008
@@ -232,6 +232,9 @@
             mockManager.add( control );
 
             configSource = (AssemblerConfigurationSource) control.getMock();
+            
+            configSource.getMavenSession();
+            control.setReturnValue( null, MockControl.ZERO_OR_MORE );
         }
 
         public void expectGetRemoteRepositories( List remoteRepos )

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTaskTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTaskTest.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTaskTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddArtifactTaskTest.java Thu Sep 11 16:02:34 2008
@@ -75,7 +75,7 @@
 
         mac.expectGetDestFile( new File( "junk" ) );
         mac.expectAddFile( artifactFile, outputLocation );
-
+        
         mockManager.replayAll();
 
         AddArtifactTask task = createTask( artifactMock.getArtifact() );
@@ -100,7 +100,7 @@
 
         mac.expectGetDestFile( new File( "junk" ) );
         mac.expectAddFile( file, outputDir + artifactId + "-" + version + "." + ext );
-
+        
         mockManager.replayAll();
 
         AddArtifactTask task = new AddArtifactTask( mock.getArtifact(), new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTaskTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTaskTest.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTaskTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTaskTest.java Thu Sep 11 16:02:34 2008
@@ -106,6 +106,8 @@
         macTask.expectGetDestFile( new File( "junk" ) );
         macTask.expectAddFile( newFile, outDir + depAid + "-" + depVer + "." + depExt, 10 );
 
+        macTask.expectGetSession( null );
+        
         mockManager.replayAll();
 
         Logger logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "test" );
@@ -180,6 +182,8 @@
         macTask.expectCSGetFinalName( "final-name" );
         macTask.expectResolveDependencies( Collections.singleton( depMock.getArtifact() ) );
         macTask.expectAddFile( file, "out/" + aid + "-" + version + "." + type );
+        
+        macTask.expectGetSession( null );
 
         DependencySet ds = new DependencySet();
         ds.setOutputDirectory( "/out" );
@@ -252,6 +256,8 @@
 
         macTask.expectGetDestFile( new File( "junk" ) );
         macTask.expectCSGetFinalName( "final-name" );
+        
+        macTask.expectGetSession( null );
 
         MavenProject depProject = new MavenProject( new Model() );
 

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddArtifactTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddArtifactTask.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddArtifactTask.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddArtifactTask.java Thu Sep 11 16:02:34 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.testutils.MockManager;
 import org.apache.maven.project.MavenProject;
@@ -70,6 +71,9 @@
     {
         configSource.getProject();
         configSourceCtl.setReturnValue( project, MockControl.ZERO_OR_MORE );
+        
+        configSource.getMavenSession();
+        configSourceCtl.setReturnValue( null, MockControl.ZERO_OR_MORE );
     }
 
     public void expectGetFinalName( String finalName )
@@ -157,4 +161,10 @@
         configSource.getReactorProjects();
         configSourceCtl.setReturnValue( projects, MockControl.ONE_OR_MORE );
     }
+    
+    public void expectGetSession( MavenSession session )
+    {
+        configSource.getMavenSession();
+        configSourceCtl.setReturnValue( session, MockControl.ONE_OR_MORE );
+    }
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddDependencySetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddDependencySetsTask.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddDependencySetsTask.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddDependencySetsTask.java Thu Sep 11 16:02:34 2008
@@ -22,6 +22,7 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.artifact.DependencyResolver;
 import org.apache.maven.plugin.assembly.testutils.MockManager;
@@ -241,5 +242,11 @@
         dependencyResolverCtl.setMatcher( MockControl.ALWAYS_MATCHER );
         dependencyResolverCtl.setReturnValue( resolvedArtifacts, MockControl.ONE_OR_MORE );
     }
+    
+    public void expectGetSession( MavenSession session )
+    {
+        configSource.getMavenSession();
+        configSourceCtl.setReturnValue( session, MockControl.ZERO_OR_MORE );
+    }
 
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java Thu Sep 11 16:02:34 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugin.assembly.testutils.MockManager;
 import org.apache.maven.plugin.assembly.testutils.TestFileManager;
@@ -61,6 +62,9 @@
         archiver = ( Archiver ) archiverCtl.getMock();
 
         archiveBaseDir = fileManager.createTempDir();
+        
+        configSource.getMavenSession();
+        configSourceCtl.setReturnValue( null, MockControl.ZERO_OR_MORE );
     }
 
     public void expectGetArchiveBaseDirectory()
@@ -152,6 +156,12 @@
         configSourceCtl.setReturnValue( project, MockControl.ONE_OR_MORE );
     }
 
+    public void expectGetSession( MavenSession session )
+    {
+        configSource.getMavenSession();
+        configSourceCtl.setReturnValue( session, MockControl.ONE_OR_MORE );
+    }
+    
     public void expectGetFinalName( String finalName )
     {
         configSource.getFinalName();

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=694529&r1=694528&r2=694529&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 Thu Sep 11 16:02:34 2008
@@ -897,6 +897,9 @@
 
         configSource.isSiteIncluded();
         configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
+        
+        configSource.isIgnoreMissingDescriptor();
+        configSourceControl.setReturnValue( false, MockControl.ZERO_OR_MORE );
 
         mockManager.replayAll();
 

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtilsTest.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtilsTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtilsTest.java Thu Sep 11 16:02:34 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
@@ -28,6 +29,7 @@
 import org.apache.maven.plugin.assembly.testutils.MockManager;
 import org.apache.maven.project.MavenProject;
 import org.easymock.MockControl;
+import org.easymock.classextension.MockClassControl;
 
 import java.util.Properties;
 
@@ -234,9 +236,23 @@
 
         artifactProject.setArtifact( artifactMock.getArtifact() );
 
+        MockControl sessionCtl = MockClassControl.createControl( MavenSession.class );
+        mockManager.add( sessionCtl );
+        
+        MavenSession session = (MavenSession) sessionCtl.getMock();
+        session.getExecutionProperties();
+        sessionCtl.setReturnValue( null, MockControl.ZERO_OR_MORE );
+        
+        MockControl csCtl = MockControl.createControl( AssemblerConfigurationSource.class );
+        mockManager.add( csCtl );
+        
+        AssemblerConfigurationSource cs = (AssemblerConfigurationSource) csCtl.getMock();
+        cs.getMavenSession();
+        csCtl.setReturnValue( session, MockControl.ZERO_OR_MORE );
+        
         mockManager.replayAll();
 
-        String result = AssemblyFormatUtils.evaluateFileNameMapping( "${artifact.artifactId}-${artifact.baseVersion}", artifactMock.getArtifact(), mainProject, artifactProject, "artifact." );
+        String result = AssemblyFormatUtils.evaluateFileNameMapping( "${artifact.artifactId}-${artifact.baseVersion}", artifactMock.getArtifact(), mainProject, artifactProject, "artifact.", cs );
 
         assertEquals( "artifact-2-SNAPSHOT", result );
 
@@ -472,18 +488,32 @@
             mainProject = new MavenProject( new Model() );
         }
 
-        ArtifactMock artifactMock = new ArtifactMock( mockManager, groupId, artifactId, version, extension, classifier, false );
+        ArtifactMock artifactMock = new ArtifactMock( mockManager, groupId, artifactId, version, extension, classifier, false, null );
+        
+        MockControl sessionCtl = MockClassControl.createControl( MavenSession.class );
+        mockManager.add( sessionCtl );
+        
+        MavenSession session = (MavenSession) sessionCtl.getMock();
+        session.getExecutionProperties();
+        sessionCtl.setReturnValue( System.getProperties(), MockControl.ZERO_OR_MORE );
+        
+        MockControl csCtl = MockControl.createControl( AssemblerConfigurationSource.class );
+        mockManager.add( csCtl );
+        
+        AssemblerConfigurationSource cs = (AssemblerConfigurationSource) csCtl.getMock();
+        cs.getMavenSession();
+        csCtl.setReturnValue( session, MockControl.ZERO_OR_MORE );
 
         mockManager.replayAll();
 
         String result;
         if ( prefix == null )
         {
-            result = AssemblyFormatUtils.evaluateFileNameMapping( expression, artifactMock.getArtifact(), mainProject, artifactProject );
+            result = AssemblyFormatUtils.evaluateFileNameMapping( expression, artifactMock.getArtifact(), mainProject, artifactProject, cs );
         }
         else
         {
-            result = AssemblyFormatUtils.evaluateFileNameMapping( expression, artifactMock.getArtifact(), mainProject, artifactProject, prefix );
+            result = AssemblyFormatUtils.evaluateFileNameMapping( expression, artifactMock.getArtifact(), mainProject, artifactProject, prefix, cs );
         }
 
         assertEquals( checkValue, result );
@@ -554,18 +584,38 @@
             artifactProject = project;
             mainProject = new MavenProject( new Model() );
         }
+        
+        MockControl sessionCtl = MockClassControl.createControl( MavenSession.class );
+        mockManager.add( sessionCtl );
+        
+        MavenSession session = (MavenSession) sessionCtl.getMock();
+        session.getExecutionProperties();
+        sessionCtl.setReturnValue( System.getProperties(), MockControl.ZERO_OR_MORE );
+        
+        MockControl csCtl = MockControl.createControl( AssemblerConfigurationSource.class );
+        mockManager.add( csCtl );
+        
+        AssemblerConfigurationSource cs = (AssemblerConfigurationSource) csCtl.getMock();
+        cs.getMavenSession();
+        csCtl.setReturnValue( session, MockControl.ZERO_OR_MORE );
 
         String result;
+        
+        mockManager.replayAll();
         if ( prefix == null )
         {
-            result = AssemblyFormatUtils.getOutputDirectory( outDir, mainProject, artifactProject, finalName );
+            result = AssemblyFormatUtils.getOutputDirectory( outDir, mainProject, artifactProject, finalName, cs );
         }
         else
         {
-            result = AssemblyFormatUtils.getOutputDirectory( outDir, mainProject, artifactProject, finalName, prefix );
+            result = AssemblyFormatUtils.getOutputDirectory( outDir, mainProject, artifactProject, finalName, prefix, cs );
         }
 
         assertEquals( checkValue, result );
+        
+        mockManager.verifyAll();
+        
+        mockManager.clear();
     }
 
     private void verifyDistroName( String assemblyId, String classifier, String finalName, boolean appendAssemblyId, String checkValue )

Modified: maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/PropertyUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/PropertyUtilsTest.java?rev=694529&r1=694528&r2=694529&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/PropertyUtilsTest.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/test/java/org/apache/maven/plugin/assembly/utils/PropertyUtilsTest.java Thu Sep 11 16:02:34 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
 import org.codehaus.plexus.util.IOUtil;
 
 import java.io.File;
@@ -34,7 +35,7 @@
 {
 
     public void testShouldNotTouchPropertiesWithNoExpressions()
-        throws IOException
+        throws IOException, AssemblyFormattingException
     {
         Properties props = new Properties();
         props.setProperty( "key", "value" );
@@ -51,7 +52,7 @@
     }
 
     public void testShouldResolveExpressionReferringToExistingKeyWithoutExpressionPrefix()
-        throws IOException
+        throws IOException, AssemblyFormattingException
     {
         Properties props = new Properties();
         props.setProperty( "key", "value" );
@@ -67,25 +68,8 @@
         assertEquals( "value", result.getProperty( "key2" ) );
     }
 
-    public void testShouldResolveExpressionReferringToExistingKeyWithExpressionPrefix()
-        throws IOException
-    {
-        Properties props = new Properties();
-        props.setProperty( "key", "value" );
-        props.setProperty( "key2", "${__properties.key}" );
-
-        File propsFile = getTempFile();
-
-        writePropertiesTo( propsFile, props );
-
-        Properties result = PropertyUtils.getInterpolatedPropertiesFromFile( propsFile, true, false );
-
-        assertEquals( "value", result.getProperty( "key" ) );
-        assertEquals( "value", result.getProperty( "key2" ) );
-    }
-
     public void testShouldResolveExpressionReferringToSysPropKeyWithoutExpressionPrefix()
-        throws IOException
+        throws IOException, AssemblyFormattingException
     {
         Properties props = new Properties();
         props.setProperty( "key", "value" );
@@ -102,26 +86,8 @@
         assertEquals( userName, result.getProperty( "key2" ) );
     }
 
-    public void testShouldResolveExpressionReferringToSysPropKeyWithExpressionPrefix()
-        throws IOException
-    {
-        Properties props = new Properties();
-        props.setProperty( "key", "value" );
-        props.setProperty( "key2", "${__properties.user.name}" );
-
-        String userName = System.getProperty( "user.name" );
-
-        File propsFile = getTempFile();
-
-        writePropertiesTo( propsFile, props );
-
-        Properties result = PropertyUtils.getInterpolatedPropertiesFromFile( propsFile, true, true );
-
-        assertEquals( userName, result.getProperty( "key2" ) );
-    }
-
     public void testShouldNotTouchExpressionReferringToNonExistentKeyWithoutExpressionPrefix()
-        throws IOException
+        throws IOException, AssemblyFormattingException
     {
         Properties props = new Properties();
         props.setProperty( "key", "value" );
@@ -136,24 +102,8 @@
         assertEquals( "${foo.bar.gobbledy.gook}", result.getProperty( "key2" ) );
     }
 
-    public void testShouldNotTouchExpressionReferringToNonExistentKeyWithExpressionPrefix()
-        throws IOException
-    {
-        Properties props = new Properties();
-        props.setProperty( "key", "value" );
-        props.setProperty( "key2", "${__properties.foo.bar.gobbledy.gook}" );
-
-        File propsFile = getTempFile();
-
-        writePropertiesTo( propsFile, props );
-
-        Properties result = PropertyUtils.getInterpolatedPropertiesFromFile( propsFile, true, false );
-
-        assertEquals( "${__properties.foo.bar.gobbledy.gook}", result.getProperty( "key2" ) );
-    }
-
     public void testShouldNotIncludeSystemProperties()
-        throws IOException
+        throws IOException, AssemblyFormattingException
     {
         Properties props = new Properties();
 
@@ -167,7 +117,7 @@
     }
 
     public void testShouldFailWhenGivenNonExistentPropertiesFileLocation()
-        throws IOException
+        throws IOException, AssemblyFormattingException
     {
         File propsFile = getTempFile();
         propsFile.delete();



Mime
View raw message