mirror of https://github.com/apache/maven.git
o Avoided creation of interpolation value sources that only apply to local builds when we have no project directory
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@783831 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e72965d38e
commit
b04e3aa641
|
@ -105,49 +105,56 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
|
||||
protected List<ValueSource> createValueSources( final Model model, final File projectDir, final ModelBuildingRequest config )
|
||||
{
|
||||
String timestampFormat = DEFAULT_BUILD_TIMESTAMP_FORMAT;
|
||||
|
||||
Properties modelProperties = model.getProperties();
|
||||
if ( modelProperties != null )
|
||||
{
|
||||
timestampFormat = modelProperties.getProperty( BUILD_TIMESTAMP_FORMAT_PROPERTY, timestampFormat );
|
||||
}
|
||||
|
||||
ValueSource modelValueSource1 = new PrefixedObjectValueSource( PROJECT_PREFIXES, model, false );
|
||||
ValueSource modelValueSource2 = new ObjectBasedValueSource( model );
|
||||
|
||||
ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ){
|
||||
// NOTE: Order counts here!
|
||||
List<ValueSource> valueSources = new ArrayList<ValueSource>( 9 );
|
||||
|
||||
if ( projectDir != null )
|
||||
{
|
||||
ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
|
||||
{
|
||||
public Object getValue( String expression )
|
||||
{
|
||||
if ( projectDir != null && "basedir".equals( expression ) )
|
||||
if ( "basedir".equals( expression ) )
|
||||
{
|
||||
return projectDir.getAbsolutePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
PROJECT_PREFIXES, true );
|
||||
ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ){
|
||||
}, PROJECT_PREFIXES, true );
|
||||
valueSources.add( basedirValueSource );
|
||||
|
||||
ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
|
||||
{
|
||||
public Object getValue( String expression )
|
||||
{
|
||||
if ( projectDir != null && "baseUri".equals( expression ) )
|
||||
if ( "baseUri".equals( expression ) )
|
||||
{
|
||||
return projectDir.getAbsoluteFile().toURI().toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
PROJECT_PREFIXES, false );
|
||||
|
||||
List<ValueSource> valueSources = new ArrayList<ValueSource>( 9 );
|
||||
|
||||
// NOTE: Order counts here!
|
||||
valueSources.add( basedirValueSource );
|
||||
}, PROJECT_PREFIXES, false );
|
||||
valueSources.add( baseUriValueSource );
|
||||
|
||||
String timestampFormat = DEFAULT_BUILD_TIMESTAMP_FORMAT;
|
||||
if ( modelProperties != null )
|
||||
{
|
||||
timestampFormat = modelProperties.getProperty( BUILD_TIMESTAMP_FORMAT_PROPERTY, timestampFormat );
|
||||
}
|
||||
valueSources.add( new BuildTimestampValueSource( config.getBuildStartTime(), timestampFormat ) );
|
||||
}
|
||||
|
||||
valueSources.add( modelValueSource1 );
|
||||
|
||||
valueSources.add( new MapBasedValueSource( modelProperties ) );
|
||||
|
||||
valueSources.add( new MapBasedValueSource( config.getExecutionProperties() ) );
|
||||
|
||||
valueSources.add( new AbstractValueSource( false )
|
||||
{
|
||||
public Object getValue( String expression )
|
||||
|
@ -155,6 +162,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
|||
return config.getExecutionProperties().getProperty( "env." + expression );
|
||||
}
|
||||
} );
|
||||
|
||||
valueSources.add( modelValueSource2 );
|
||||
|
||||
return valueSources;
|
||||
|
|
Loading…
Reference in New Issue