mirror of https://github.com/apache/maven.git
[MNG-4208] [regression] CLI properties can't override project properties during interpolation
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@785752 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3843481a3b
commit
a51aba1cd6
|
@ -1622,6 +1622,16 @@ public class PomConstructionTest
|
|||
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();
|
||||
|
|
|
@ -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>
|
|
@ -151,10 +151,10 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
|
||||
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 )
|
||||
|
|
Loading…
Reference in New Issue