reduced warning-noise: only print warnings for SNAPSHOT models, and removed deprecation for project.* expressions, see comment in code

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@553144 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kenney Westerhof 2007-07-04 09:48:06 +00:00
parent 5da9d28906
commit ef22e43b64
1 changed files with 15 additions and 6 deletions

View File

@ -130,6 +130,10 @@ public class RegexBasedModelInterpolator
{ {
Logger logger = getLogger(); Logger logger = getLogger();
boolean isSnapshotModel = ( model.getVersion() == null
? model.getParent() == null ? "" : model.getParent().getVersion()
: model.getVersion() ).indexOf( "SNAPSHOT" ) >= 0;
String result = src; String result = src;
Matcher matcher = EXPRESSION_PATTERN.matcher( result ); Matcher matcher = EXPRESSION_PATTERN.matcher( result );
while ( matcher.find() ) while ( matcher.find() )
@ -144,11 +148,16 @@ public class RegexBasedModelInterpolator
boolean isPomExpression = "pom.".equals( prefix ) || "project.".equals( prefix ); boolean isPomExpression = "pom.".equals( prefix ) || "project.".equals( prefix );
if ( logger != null && "project.".equals( prefix ) ) // TODO
{ // I don't think we should deprecate this as it's used in plugin params aswell,
logger.warn( "Deprecated expression: " + wholeExpr + " - 'project.' prefix is deprecated." // and project.build.outputDirectory etc. are documented.
+ " Use 'pom.': ${pom." + realExpr + "} (model: " + model.getId() + ")" ); // For now I'll allow both pom. and project.
} // Perhaps pom. should be deprecated instead?
// if ( isSnapshotModel && logger != null && "project.".equals( prefix ) )
// {
// logger.warn( "Deprecated expression: " + wholeExpr + " - 'project.' prefix is deprecated."
// + " Use 'pom.': ${pom." + realExpr + "} (model: " + model.getId() + ")" );
// }
if ( isPomExpression ) if ( isPomExpression )
{ {
@ -179,7 +188,7 @@ public class RegexBasedModelInterpolator
{ {
value = getValueFromModel( realExpr, model, wholeExpr, logger ); value = getValueFromModel( realExpr, model, wholeExpr, logger );
if ( value != null && logger != null ) if ( isSnapshotModel && value != null && logger != null )
{ {
logger.warn( "Deprecated expression: " + wholeExpr + " - missing prefix. Use ${pom." logger.warn( "Deprecated expression: " + wholeExpr + " - missing prefix. Use ${pom."
+ realExpr + "} (model: " + model.getId() + ")" ); + realExpr + "} (model: " + model.getId() + ")" );