// 1C
if ( moduleProject != null )
{
interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleProject ) );
interpolator.addValueSource( new PrefixedPropertiesValueSource( "module.properties.",
moduleProject.getProperties() ) );
if ( moduleProject.getArtifact() != null )
{
interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleProject.getArtifact() ) );
}
}
// 2A
interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifact ) );
// 2B
interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifact.getArtifactHandler() ) );
interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.handler.", artifact.getArtifactHandler() ) );
// 2C
if ( artifactProject != null )
{
interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject ) );
interpolator.addValueSource( new PrefixedPropertiesValueSource( "artifact.properties.",
artifactProject.getProperties() ) );
if ( artifactProject.getArtifact() != null )
{
interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject.getArtifact() ) );
}
}
if ( mainProject != null )
{
// 3
// 4
interpolator.addValueSource( new PrefixedObjectValueSource( InterpolationConstants.PROJECT_PREFIXES,
mainProject, true ) );
}
final Properties specialRules = new Properties();
final String classifier = ProjectUtils.getClassifier( artifact );
if ( classifier != null )
{
specialRules.setProperty( "dashClassifier?", "-" + classifier );
specialRules.setProperty( "dashClassifier", "-" + classifier );
}
else
{
specialRules.setProperty( "dashClassifier?", "" );
specialRules.setProperty( "dashClassifier", "" );
}
// 5
interpolator.addValueSource( new PropertiesBasedValueSource( specialRules ) );
MavenSession session = null;
if ( configSource != null )
{
session = configSource.getMavenSession();
if ( session != null )
{
Properties userProperties = null;
try
{
userProperties = session.getExecutionProperties();
}
catch ( final 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 )
{
// 7
interpolator.addValueSource( new PrefixedPropertiesValueSource(
InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
mainProject.getProperties(), true ) );
}
Properties commandLineProperties = System.getProperties();
if ( session != null )
{
commandLineProperties = new Properties();
if ( session.getExecutionProperties() != null )
{
commandLineProperties.putAll( session.getExecutionProperties() );
}
if ( session.getUserProperties() != null )
{
commandLineProperties.putAll( session.getUserProperties() );
}
}
// 8
interpolator.addValueSource( new PropertiesBasedValueSource( commandLineProperties ) );
try
{
// 9
interpolator.addValueSource( new PrefixedPropertiesValueSource( Collections.singletonList( "env." ),
CommandLineUtils.getSystemEnvVars( false ),
true ) );
}
catch ( final IOException e )
{