You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/06/17 20:44:20 UTC

svn commit: r785752 - in /maven/components/trunk: maven-core/src/test/java/org/apache/maven/project/ maven-core/src/test/resources-project-builder/interpolation-cli-wins/ maven-model-builder/src/main/java/org/apache/maven/model/interpolation/

Author: bentmann
Date: Wed Jun 17 18:44:19 2009
New Revision: 785752

URL: http://svn.apache.org/viewvc?rev=785752&view=rev
Log:
[MNG-4208] [regression] CLI properties can't override project properties during interpolation

Added:
    maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/   (with props)
    maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/pom.xml   (with props)
Modified:
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=785752&r1=785751&r2=785752&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java Wed Jun 17 18:44:19 2009
@@ -1622,6 +1622,16 @@
         assertEquals( "maven-it-plugin-configuration", pom.getValue( "reporting/plugins[3]/artifactId" ) );
     }
 
+    public void testCliPropsDominateProjectPropsDuringInterpolation()
+        throws Exception
+    {
+        Properties props = new Properties();
+        props.setProperty( "testProperty", "PASSED" );
+        PomTestWrapper pom = buildPom( "interpolation-cli-wins", props );
+
+        assertEquals( "PASSED", pom.getValue( "properties/interpolatedProperty" ) );
+    }
+
     private void assertPathSuffixEquals( String expected, Object actual )
     {
         String a = actual.toString();

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/
------------------------------------------------------------------------------
    bugtraq:label = Enter issue ID:

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/
------------------------------------------------------------------------------
    bugtraq:message = Issue id: %BUGID%

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/
------------------------------------------------------------------------------
    bugtraq:number = false

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Added: maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/pom.xml?rev=785752&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/pom.xml (added)
+++ maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/pom.xml Wed Jun 17 18:44:19 2009
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng4208</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: MNG-4208</name>
+  <description>
+    Test that CLI properties specified by the user override project properties during interpolation.
+  </description>
+
+  <properties>
+    <testProperty>FAILED</testProperty>
+    <interpolatedProperty>${testProperty}</interpolatedProperty>
+  </properties>
+</project>

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/interpolation-cli-wins/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java?rev=785752&r1=785751&r2=785752&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java (original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java Wed Jun 17 18:44:19 2009
@@ -151,10 +151,10 @@
 
         valueSources.add( modelValueSource1 );
 
-        valueSources.add( new MapBasedValueSource( modelProperties ) );
-
         valueSources.add( new MapBasedValueSource( config.getExecutionProperties() ) );
 
+        valueSources.add( new MapBasedValueSource( modelProperties ) );
+
         valueSources.add( new AbstractValueSource( false )
         {
             public Object getValue( String expression )