You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/06/11 18:17:49 UTC

svn commit: r783831 - /maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java

Author: bentmann
Date: Thu Jun 11 16:17:49 2009
New Revision: 783831

URL: http://svn.apache.org/viewvc?rev=783831&view=rev
Log:
o Avoided creation of interpolation value sources that only apply to local builds when we have no project directory

Modified:
    maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java

Modified: maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java?rev=783831&r1=783830&r2=783831&view=diff
==============================================================================
--- maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java (original)
+++ maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java Thu Jun 11 16:17:49 2009
@@ -105,49 +105,56 @@
 
     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 ){
-            public Object getValue( String expression )
+        // NOTE: Order counts here!
+        List<ValueSource> valueSources = new ArrayList<ValueSource>( 9 );
+
+        if ( projectDir != null )
+        {
+            ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
             {
-                if ( projectDir != null && "basedir".equals( expression ) )
+                public Object getValue( String expression )
                 {
-                    return projectDir.getAbsolutePath();
+                    if ( "basedir".equals( expression ) )
+                    {
+                        return projectDir.getAbsolutePath();
+                    }
+                    return null;
                 }
-                return null;
-            }
-        },
-        PROJECT_PREFIXES, true );
-        ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ){
-            public Object getValue( String expression )
+            }, PROJECT_PREFIXES, true );
+            valueSources.add( basedirValueSource );
+
+            ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
             {
-                if ( projectDir != null && "baseUri".equals( expression ) )
+                public Object getValue( String expression )
                 {
-                    return projectDir.getAbsoluteFile().toURI().toString();
+                    if ( "baseUri".equals( expression ) )
+                    {
+                        return projectDir.getAbsoluteFile().toURI().toString();
+                    }
+                    return null;
                 }
-                return null;
+            }, PROJECT_PREFIXES, false );
+            valueSources.add( baseUriValueSource );
+
+            String timestampFormat = DEFAULT_BUILD_TIMESTAMP_FORMAT;
+            if ( modelProperties != null )
+            {
+                timestampFormat = modelProperties.getProperty( BUILD_TIMESTAMP_FORMAT_PROPERTY, timestampFormat );
             }
-        },
-        PROJECT_PREFIXES, false );
-        
-        List<ValueSource> valueSources = new ArrayList<ValueSource>( 9 );
-        
-        // NOTE: Order counts here!
-        valueSources.add( basedirValueSource );
-        valueSources.add( baseUriValueSource );
-        valueSources.add( new BuildTimestampValueSource( config.getBuildStartTime(), 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,8 +162,9 @@
                 return config.getExecutionProperties().getProperty( "env." + expression );
             }
         } );
+
         valueSources.add( modelValueSource2 );
-        
+
         return valueSources;
     }