mirror of https://github.com/apache/maven.git
[MNG-4837] Interpolation error due to cyclic expression for one of the POM coordinates gets needlessly repeated
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1000601 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0707794c27
commit
3fca2bb2d6
|
@ -324,6 +324,11 @@ public class StringSearchModelInterpolator
|
|||
|
||||
private boolean isQualifiedForInterpolation( Field field, Class<?> fieldType )
|
||||
{
|
||||
if ( Map.class.equals( fieldType ) && "locations".equals( field.getName() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Boolean primitive = fieldIsPrimitiveByClass.get( fieldType );
|
||||
if ( primitive == null )
|
||||
{
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.model.interpolation;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.InputLocation;
|
||||
import org.apache.maven.model.InputSource;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.building.DefaultModelBuildingRequest;
|
||||
import org.apache.maven.model.building.ModelBuildingRequest;
|
||||
|
@ -482,4 +484,27 @@ public class StringSearchModelInterpolatorTest
|
|||
{
|
||||
public static final String CONSTANT = "${expression}";
|
||||
}
|
||||
|
||||
public void testLocationTrackerShouldBeExcludedFromInterpolation()
|
||||
{
|
||||
Properties props = new Properties();
|
||||
props.setProperty( "expression", "value" );
|
||||
DefaultModelBuildingRequest request = new DefaultModelBuildingRequest();
|
||||
request.setUserProperties( props );
|
||||
|
||||
InputSource source = new InputSource();
|
||||
source.setLocation( "${expression}" );
|
||||
source.setModelId( "${expression}" );
|
||||
Model model = new Model();
|
||||
model.setLocation( "", new InputLocation( 1, 1, source ) );
|
||||
|
||||
SimpleProblemCollector problems = new SimpleProblemCollector();
|
||||
StringSearchModelInterpolator interpolator = new StringSearchModelInterpolator();
|
||||
interpolator.interpolateObject( model, model, null, request, problems );
|
||||
|
||||
assertProblemFree( problems );
|
||||
assertEquals( "${expression}", source.getLocation() );
|
||||
assertEquals( "${expression}", source.getModelId() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue