You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Brett Porter <br...@apache.org> on 2008/03/17 01:16:20 UTC

Re: svn commit: r637324 - in /maven/components/branches/maven-2.0.x/maven-project/src: main/java/org/apache/maven/project/ test/java/org/apache/maven/project/ test/resources/projects/

Hey John,

I can't see a problem one way or the other here, I just noticed you  
moved the caching - can you elaborate a bit on why that was necessary,  
and are you sure it won't cause any problems with caching resolved  
information? It looks like it is now after interpolation, and ISTR  
that giving me grief in the past.

Thanks,
Brett

On 15/03/2008, at 12:25 PM, jdcasey@apache.org wrote:

> Author: jdcasey
> Date: Fri Mar 14 18:25:12 2008
> New Revision: 637324
>
> URL: http://svn.apache.org/viewvc?rev=637324&view=rev
> Log:
> [MNG-3355] Make expressions referencing build directories resolve  
> and use translated paths when the project is local (NOT from a  
> repository, where the project.getFile() returns null). Unit test  
> included.
>
> Added:
>    maven/components/branches/maven-2.0.x/maven-project/src/test/ 
> resources/projects/build-path-expression-pom.xml   (with props)
> Modified:
>    maven/components/branches/maven-2.0.x/maven-project/src/main/java/ 
> org/apache/maven/project/DefaultMavenProjectBuilder.java
>    maven/components/branches/maven-2.0.x/maven-project/src/test/java/ 
> org/apache/maven/project/DefaultMavenProjectBuilderTest.java
>
> Modified: maven/components/branches/maven-2.0.x/maven-project/src/ 
> main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
> URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=637324&r1=637323&r2=637324&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- maven/components/branches/maven-2.0.x/maven-project/src/main/ 
> java/org/apache/maven/project/DefaultMavenProjectBuilder.java  
> (original)
> +++ maven/components/branches/maven-2.0.x/maven-project/src/main/ 
> java/org/apache/maven/project/DefaultMavenProjectBuilder.java Fri  
> Mar 14 18:25:12 2008
> @@ -862,14 +862,15 @@
>         }
>
>         processedProjectCache.put(
> -            createCacheKey( project.getGroupId(),  
> project.getArtifactId(), project.getVersion() ), project );
> +                                   
> createCacheKey( project.getGroupId(), project.getArtifactId(),  
> project.getVersion() ), project );
>
> -        // jvz:note
> +          // jvz:note
>         // this only happens if we are building from a source file
>         if ( projectDescriptor != null )
>         {
>             // Only translate the base directory for files in the  
> source tree
> -             
> pathTranslator.alignToBaseDirectory( project.getModel(),  
> projectDescriptor.getParentFile() );
> +            pathTranslator.alignToBaseDirectory( project.getModel(),
> +                                                 projectDir );
>
>             Build build = project.getBuild();
>
> @@ -883,24 +884,9 @@
>             project.setFile( projectDescriptor );
>         }
>
> -        MavenProject rawParent = project.getParent();
> -
> -        if ( rawParent != null )
> -        {
> -            String cacheKey =
> -                createCacheKey( rawParent.getGroupId(),  
> rawParent.getArtifactId(), rawParent.getVersion() );
> -
> -            MavenProject processedParent = (MavenProject)  
> processedProjectCache.get( cacheKey );
> -
> -            // yeah, this null check might be a bit paranoid, but  
> better safe than sorry...
> -            if ( processedParent != null )
> -            {
> -                project.setParent( processedParent );
> -            }
> -        }
> -
> -        project.setManagedVersionMap(
> -            createManagedVersionMap( projectId,  
> project.getDependencyManagement(), project.getParent() ) );
> +         
> project.setManagedVersionMap( createManagedVersionMap( projectId,
> +                                                                
> project.getDependencyManagement(),
> +                                                                
> project.getParent() ) );
>
>         return project;
>     }
> @@ -971,23 +957,26 @@
>         // We don't need all the project methods that are added over  
> those in the model, but we do need basedir
>         Map context = new HashMap();
>
> +        Build build = model.getBuild();
> +
>         if ( projectDir != null )
>         {
>             context.put( "basedir", projectDir.getAbsolutePath() );
> -        }
>
> -        // TODO: this is a hack to ensure MNG-2124 can be satisfied  
> without triggering MNG-1927
> -        //  MNG-1927 relies on the false assumption that $ 
> {project.build.*} evaluates to null, which occurs before
> -        //  MNG-2124 is fixed. The null value would leave it  
> uninterpolated, to be handled after path translation.
> -        //  Until these steps are correctly sequenced, we guarantee  
> these fields remain uninterpolated.
> -        context.put( "build.directory", null );
> -        context.put( "build.outputDirectory", null );
> -        context.put( "build.testOutputDirectory", null );
> -        context.put( "build.sourceDirectory", null );
> -        context.put( "build.testSourceDirectory", null );
> +            // MNG-1927, MNG-2124, MNG-3355:
> +            // If the build section is present and the project  
> directory is non-null, we should make
> +            // sure interpolation of the directories below uses  
> translated paths.
> +            // Afterward, we'll double back and translate any paths  
> that weren't covered during interpolation via the
> +            // code below...
> +            context.put( "build.directory",  
> pathTranslator.alignToBaseDirectory( build.getDirectory(),  
> projectDir ) );
> +            context.put( "build.outputDirectory",  
> pathTranslator.alignToBaseDirectory( build.getOutputDirectory(),  
> projectDir ) );
> +            context.put( "build.testOutputDirectory",  
> pathTranslator.alignToBaseDirectory( build.getTestOutputDirectory(),  
> projectDir ) );
> +            context.put( "build.sourceDirectory",  
> pathTranslator.alignToBaseDirectory( build.getSourceDirectory(),  
> projectDir ) );
> +            context.put( "build.testSourceDirectory",  
> pathTranslator.alignToBaseDirectory( build.getTestSourceDirectory(),  
> projectDir ) );
> +        }
>
>         model = modelInterpolator.interpolate( model, context,  
> strict );
> -
> +
>         // [MNG-2339] ensure the system properties are still  
> interpolated for backwards compat, but the model values must win
>         context.putAll( System.getProperties() );
>         model = modelInterpolator.interpolate( model, context,  
> strict );
> @@ -1032,13 +1021,31 @@
>             }
>         }
>
> -        project.setParent( parentProject );
> -
>         if ( parentProject != null )
>         {
> -            Artifact parentArtifact =  
> artifactFactory.createParentArtifact( parentProject.getGroupId(),
> -                                                                            parentProject 
> .getArtifactId(),
> -                                                                            parentProject 
> .getVersion() );
> +            String cacheKey =  
> createCacheKey( parentProject.getGroupId(),
> +                                               
> parentProject.getArtifactId(),
> +                                               
> parentProject.getVersion() );
> +
> +            MavenProject processedParent = (MavenProject)  
> processedProjectCache.get( cacheKey );
> +            Artifact parentArtifact;
> +
> +            // yeah, this null check might be a bit paranoid, but  
> better safe than sorry...
> +            if ( processedParent != null )
> +            {
> +                project.setParent( processedParent );
> +
> +                parentArtifact = processedParent.getArtifact();
> +            }
> +            else
> +            {
> +                project.setParent( parentProject );
> +
> +                parentArtifact =  
> artifactFactory.createParentArtifact( parentProject.getGroupId(),
> + 
>                                                                                 parentProject 
> .getArtifactId(),
> + 
>                                                                                 parentProject 
> .getVersion() );
> +            }
> +
>             project.setParentArtifact( parentArtifact );
>         }
>
>
> Modified: maven/components/branches/maven-2.0.x/maven-project/src/ 
> test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
> URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java?rev=637324&r1=637323&r2=637324&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- maven/components/branches/maven-2.0.x/maven-project/src/test/ 
> java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java  
> (original)
> +++ maven/components/branches/maven-2.0.x/maven-project/src/test/ 
> java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java  
> Fri Mar 14 18:25:12 2008
> @@ -19,22 +19,24 @@
>  * under the License.
>  */
>
> -import java.io.File;
> -import java.util.ArrayList;
> -import java.util.Iterator;
> -import java.util.List;
> -import java.util.Properties;
> -
> import org.apache.maven.artifact.repository.ArtifactRepository;
> import org.apache.maven.artifact.repository.DefaultArtifactRepository;
> import  
> org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
> +import org.apache.maven.model.Build;
> import org.apache.maven.model.Plugin;
> import org.apache.maven.model.Profile;
> import org.apache.maven.model.Repository;
> +import org.apache.maven.model.Resource;
> import org.apache.maven.profiles.DefaultProfileManager;
> import org.apache.maven.profiles.ProfileManager;
> import org.codehaus.plexus.util.FileUtils;
>
> +import java.io.File;
> +import java.util.ArrayList;
> +import java.util.Iterator;
> +import java.util.List;
> +import java.util.Properties;
> +
> public class DefaultMavenProjectBuilderTest
>     extends AbstractMavenProjectTestCase
> {
> @@ -148,7 +150,7 @@
>
>     /**
>      * Check that we can build ok from the middle pom of a  
> (parent,child,grandchild) heirarchy
> -     * @throws Exception
> +     * @throws Exception
>      */
>     public void testBuildFromMiddlePom() throws Exception
>     {
> @@ -156,23 +158,45 @@
>         File f2 = getTestFile( "src/test/resources/projects/ 
> grandchild-check/child/grandchild/pom.xml");
>
>         getProject( f1 );
> -
> +
>         // it's the building of the grandchild project, having  
> already cached the child project
>         // (but not the parent project), which causes the problem.
>         getProject( f2 );
>     }
> -
> +
>      public void testDuplicatePluginDefinitionsMerged()
>          throws Exception
>      {
>          File f1 = getTestFile( "src/test/resources/projects/ 
> duplicate-plugins-merged-pom.xml" );
> -
> +
>          MavenProject project = getProject( f1 );
> -
> +
>          assertEquals( 2, ( (Plugin)  
> project.getBuildPlugins().get( 0 ) ).getDependencies().size() );
>      }
> -
> -	
> +
> +     public void  
> testBuildDirectoryExpressionInterpolatedWithTranslatedValue()
> +        throws Exception
> +     {
> +         File pom = getTestFile( "src/test/resources/projects/build- 
> path-expression-pom.xml" );
> +
> +         MavenProject project = getProject( pom );
> +
> +         Build build = project.getBuild();
> +         assertNotNull( "Project should have a build section  
> containing the test resource.", build );
> +
> +         String sourceDirectory = build.getSourceDirectory();
> +         assertNotNull( "Project build should contain a valid  
> source directory.", sourceDirectory );
> +
> +         List resources = build.getResources();
> +         assertNotNull( "Project should contain a build resource.",  
> resources );
> +         assertEquals( "Project should contain exactly one build  
> resource.", 1, resources.size() );
> +
> +         Resource res = (Resource) resources.get( 0 );
> +         assertEquals( "Project resource should be the same  
> directory as the source directory.", sourceDirectory,  
> res.getDirectory() );
> +
> +         System.out.println( "Interpolated, translated resource  
> directory is: " + res.getDirectory() );
> +     }
> +
>     protected ArtifactRepository getLocalRepository()
>         throws Exception
>     {
>
> Added: maven/components/branches/maven-2.0.x/maven-project/src/test/ 
> resources/projects/build-path-expression-pom.xml
> URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/test/resources/projects/build-path-expression-pom.xml?rev=637324&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- maven/components/branches/maven-2.0.x/maven-project/src/test/ 
> resources/projects/build-path-expression-pom.xml (added)
> +++ maven/components/branches/maven-2.0.x/maven-project/src/test/ 
> resources/projects/build-path-expression-pom.xml Fri Mar 14 18:25:12  
> 2008
> @@ -0,0 +1,14 @@
> +<project>
> +  <modelVersion>4.0.0</modelVersion>
> +  <groupId>org.apache.maven.project.tests</groupId>
> +  <artifactId>build-path-expression</artifactId>
> +  <version>1</version>
> +  <build>
> +    <sourceDirectory>sources</sourceDirectory>
> +    <resources>
> +      <resource>
> +        <directory>${project.build.sourceDirectory}</directory>
> +      </resource>
> +    </resources>
> +  </build>
> +</project>
> \ No newline at end of file
>
> Propchange: maven/components/branches/maven-2.0.x/maven-project/src/ 
> test/resources/projects/build-path-expression-pom.xml
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: maven/components/branches/maven-2.0.x/maven-project/src/ 
> test/resources/projects/build-path-expression-pom.xml
> ------------------------------------------------------------------------------
>    svn:keywords = "Author Date Id Revision"
>
>

--
Brett Porter
brett@apache.org
http://blogs.exist.com/bporter/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r637324 - in /maven/components/branches/maven-2.0.x/maven-project/src: main/java/org/apache/maven/project/ test/java/org/apache/maven/project/ test/resources/projects/

Posted by John Casey <jd...@commonjava.org>.
Well, I took a pretty careful look at things before I made this  
switch, and even made a couple of attempts that failed in the various  
testing stages.

As far as I could tell, the process-project cache is not used at all  
for inheritance calculations (assembleLineage calls itself  
recursively to build the lineage from the current project back to the  
super-POM). In the old code, we had three places where the current  
project's parent was being accessed/calculated (these are listed in  
the order Maven processes them):

1. in assembleLineage, which doesn't produce a fully-complete project  
instance for the parent, since it hasn't undergone any of the other  
logic present in buildInternal(..).
2. in processProjectLogic, where the parent artifact is created and  
the parent instance is restored after model interpolation causes  
reconstruction of the current project instance
3. in buildInternal, just before we're done with project  
construction, all of the parent calculations above are used to see  
whether there is a parent project in the processed-project cache that  
can be substituted in for the one we already have.

In looking at this, it seems apparent that there are three critical  
things that have to happen, BUT they only need two steps to put them  
into effect:

1. Lineage assembly requires unprocessed projects so that the later  
inheritance assembly (which happens between assembleLineage and  
processProjectLogic, in the buildInternal method) doesn't get  
interpolated or path-translated values.

2. The parent needs to reflect any post-process information we have  
about it, so that if we've already loaded that project as part of the  
reactor build, it will contain interpolated and path-translated  
values when we return the current project instance to the caller.

NOTE: This seems like it may have a pitfall, since what happens if  
that parent project hasn't been processed yet? I'm not sure the  
parent project will ever be cached in those cases, which also has the  
side effect that references to that project as parents may not point  
at the same instance, meaning the information is not shared (if it's  
changed by one, will it be different for the rest, is the real  
question). I'm not sure what the effect of this would be, but at the  
very least it seems like a source of potential inconsistency.

3. The parent's Artifact needs to be set on the current project. This  
really just means creating a new Artifact instance (at least, unless/ 
until we use artifact-instance caching in the ArtifactFactory to  
replicate the sharing we have of project instances through the  
processedProjectCache).

We don't need to separate the last two items. They can be performed  
at the same time, which is exactly what that shift does.

Hopefully I haven't missed anything, but if I have it's probably a  
pretty good indication that we need a test case to cover it. Do you  
have a case in mind where the above logic might fail?

-john

On Mar 16, 2008, at 8:16 PM, Brett Porter wrote:

> Hey John,
>
> I can't see a problem one way or the other here, I just noticed you  
> moved the caching - can you elaborate a bit on why that was  
> necessary, and are you sure it won't cause any problems with  
> caching resolved information? It looks like it is now after  
> interpolation, and ISTR that giving me grief in the past.
>
> Thanks,
> Brett
>
> On 15/03/2008, at 12:25 PM, jdcasey@apache.org wrote:
>
>> Author: jdcasey
>> Date: Fri Mar 14 18:25:12 2008
>> New Revision: 637324
>>
>> URL: http://svn.apache.org/viewvc?rev=637324&view=rev
>> Log:
>> [MNG-3355] Make expressions referencing build directories resolve  
>> and use translated paths when the project is local (NOT from a  
>> repository, where the project.getFile() returns null). Unit test  
>> included.
>>
>> Added:
>>    maven/components/branches/maven-2.0.x/maven-project/src/test/ 
>> resources/projects/build-path-expression-pom.xml   (with props)
>> Modified:
>>    maven/components/branches/maven-2.0.x/maven-project/src/main/ 
>> java/org/apache/maven/project/DefaultMavenProjectBuilder.java
>>    maven/components/branches/maven-2.0.x/maven-project/src/test/ 
>> java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
>>
>> Modified: maven/components/branches/maven-2.0.x/maven-project/src/ 
>> main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
>> URL: http://svn.apache.org/viewvc/maven/components/branches/ 
>> maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ 
>> DefaultMavenProjectBuilder.java? 
>> rev=637324&r1=637323&r2=637324&view=diff
>> ===================================================================== 
>> =========
>> --- maven/components/branches/maven-2.0.x/maven-project/src/main/ 
>> java/org/apache/maven/project/DefaultMavenProjectBuilder.java  
>> (original)
>> +++ maven/components/branches/maven-2.0.x/maven-project/src/main/ 
>> java/org/apache/maven/project/DefaultMavenProjectBuilder.java Fri  
>> Mar 14 18:25:12 2008
>> @@ -862,14 +862,15 @@
>>         }
>>
>>         processedProjectCache.put(
>> -            createCacheKey( project.getGroupId(),  
>> project.getArtifactId(), project.getVersion() ), project );
>> +                                  createCacheKey 
>> ( project.getGroupId(), project.getArtifactId(), project.getVersion 
>> () ), project );
>>
>> -        // jvz:note
>> +          // jvz:note
>>         // this only happens if we are building from a source file
>>         if ( projectDescriptor != null )
>>         {
>>             // Only translate the base directory for files in the  
>> source tree
>> -            pathTranslator.alignToBaseDirectory( project.getModel 
>> (), projectDescriptor.getParentFile() );
>> +            pathTranslator.alignToBaseDirectory( project.getModel(),
>> +                                                 projectDir );
>>
>>             Build build = project.getBuild();
>>
>> @@ -883,24 +884,9 @@
>>             project.setFile( projectDescriptor );
>>         }
>>
>> -        MavenProject rawParent = project.getParent();
>> -
>> -        if ( rawParent != null )
>> -        {
>> -            String cacheKey =
>> -                createCacheKey( rawParent.getGroupId(),  
>> rawParent.getArtifactId(), rawParent.getVersion() );
>> -
>> -            MavenProject processedParent = (MavenProject)  
>> processedProjectCache.get( cacheKey );
>> -
>> -            // yeah, this null check might be a bit paranoid, but  
>> better safe than sorry...
>> -            if ( processedParent != null )
>> -            {
>> -                project.setParent( processedParent );
>> -            }
>> -        }
>> -
>> -        project.setManagedVersionMap(
>> -            createManagedVersionMap( projectId,  
>> project.getDependencyManagement(), project.getParent() ) );
>> +        project.setManagedVersionMap( createManagedVersionMap 
>> ( projectId,
>> +                                                                
>> project.getDependencyManagement(),
>> +                                                                
>> project.getParent() ) );
>>
>>         return project;
>>     }
>> @@ -971,23 +957,26 @@
>>         // We don't need all the project methods that are added  
>> over those in the model, but we do need basedir
>>         Map context = new HashMap();
>>
>> +        Build build = model.getBuild();
>> +
>>         if ( projectDir != null )
>>         {
>>             context.put( "basedir", projectDir.getAbsolutePath() );
>> -        }
>>
>> -        // TODO: this is a hack to ensure MNG-2124 can be  
>> satisfied without triggering MNG-1927
>> -        //  MNG-1927 relies on the false assumption that $ 
>> {project.build.*} evaluates to null, which occurs before
>> -        //  MNG-2124 is fixed. The null value would leave it  
>> uninterpolated, to be handled after path translation.
>> -        //  Until these steps are correctly sequenced, we  
>> guarantee these fields remain uninterpolated.
>> -        context.put( "build.directory", null );
>> -        context.put( "build.outputDirectory", null );
>> -        context.put( "build.testOutputDirectory", null );
>> -        context.put( "build.sourceDirectory", null );
>> -        context.put( "build.testSourceDirectory", null );
>> +            // MNG-1927, MNG-2124, MNG-3355:
>> +            // If the build section is present and the project  
>> directory is non-null, we should make
>> +            // sure interpolation of the directories below uses  
>> translated paths.
>> +            // Afterward, we'll double back and translate any  
>> paths that weren't covered during interpolation via the
>> +            // code below...
>> +            context.put( "build.directory",  
>> pathTranslator.alignToBaseDirectory( build.getDirectory(),  
>> projectDir ) );
>> +            context.put( "build.outputDirectory",  
>> pathTranslator.alignToBaseDirectory( build.getOutputDirectory(),  
>> projectDir ) );
>> +            context.put( "build.testOutputDirectory",  
>> pathTranslator.alignToBaseDirectory( build.getTestOutputDirectory 
>> (), projectDir ) );
>> +            context.put( "build.sourceDirectory",  
>> pathTranslator.alignToBaseDirectory( build.getSourceDirectory(),  
>> projectDir ) );
>> +            context.put( "build.testSourceDirectory",  
>> pathTranslator.alignToBaseDirectory( build.getTestSourceDirectory 
>> (), projectDir ) );
>> +        }
>>
>>         model = modelInterpolator.interpolate( model, context,  
>> strict );
>> -
>> +
>>         // [MNG-2339] ensure the system properties are still  
>> interpolated for backwards compat, but the model values must win
>>         context.putAll( System.getProperties() );
>>         model = modelInterpolator.interpolate( model, context,  
>> strict );
>> @@ -1032,13 +1021,31 @@
>>             }
>>         }
>>
>> -        project.setParent( parentProject );
>> -
>>         if ( parentProject != null )
>>         {
>> -            Artifact parentArtifact =  
>> artifactFactory.createParentArtifact( parentProject.getGroupId(),
>> -                                                                     
>>         parentProject.getArtifactId(),
>> -                                                                     
>>         parentProject.getVersion() );
>> +            String cacheKey = createCacheKey 
>> ( parentProject.getGroupId(),
>> +                                               
>> parentProject.getArtifactId(),
>> +                                               
>> parentProject.getVersion() );
>> +
>> +            MavenProject processedParent = (MavenProject)  
>> processedProjectCache.get( cacheKey );
>> +            Artifact parentArtifact;
>> +
>> +            // yeah, this null check might be a bit paranoid, but  
>> better safe than sorry...
>> +            if ( processedParent != null )
>> +            {
>> +                project.setParent( processedParent );
>> +
>> +                parentArtifact = processedParent.getArtifact();
>> +            }
>> +            else
>> +            {
>> +                project.setParent( parentProject );
>> +
>> +                parentArtifact =  
>> artifactFactory.createParentArtifact( parentProject.getGroupId(),
>> +                                                                     
>>             parentProject.getArtifactId(),
>> +                                                                     
>>             parentProject.getVersion() );
>> +            }
>> +
>>             project.setParentArtifact( parentArtifact );
>>         }
>>
>>
>> Modified: maven/components/branches/maven-2.0.x/maven-project/src/ 
>> test/java/org/apache/maven/project/ 
>> DefaultMavenProjectBuilderTest.java
>> URL: http://svn.apache.org/viewvc/maven/components/branches/ 
>> maven-2.0.x/maven-project/src/test/java/org/apache/maven/project/ 
>> DefaultMavenProjectBuilderTest.java? 
>> rev=637324&r1=637323&r2=637324&view=diff
>> ===================================================================== 
>> =========
>> --- maven/components/branches/maven-2.0.x/maven-project/src/test/ 
>> java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java  
>> (original)
>> +++ maven/components/branches/maven-2.0.x/maven-project/src/test/ 
>> java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java  
>> Fri Mar 14 18:25:12 2008
>> @@ -19,22 +19,24 @@
>>  * under the License.
>>  */
>>
>> -import java.io.File;
>> -import java.util.ArrayList;
>> -import java.util.Iterator;
>> -import java.util.List;
>> -import java.util.Properties;
>> -
>> import org.apache.maven.artifact.repository.ArtifactRepository;
>> import  
>> org.apache.maven.artifact.repository.DefaultArtifactRepository;
>> import  
>> org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
>> +import org.apache.maven.model.Build;
>> import org.apache.maven.model.Plugin;
>> import org.apache.maven.model.Profile;
>> import org.apache.maven.model.Repository;
>> +import org.apache.maven.model.Resource;
>> import org.apache.maven.profiles.DefaultProfileManager;
>> import org.apache.maven.profiles.ProfileManager;
>> import org.codehaus.plexus.util.FileUtils;
>>
>> +import java.io.File;
>> +import java.util.ArrayList;
>> +import java.util.Iterator;
>> +import java.util.List;
>> +import java.util.Properties;
>> +
>> public class DefaultMavenProjectBuilderTest
>>     extends AbstractMavenProjectTestCase
>> {
>> @@ -148,7 +150,7 @@
>>
>>     /**
>>      * Check that we can build ok from the middle pom of a  
>> (parent,child,grandchild) heirarchy
>> -     * @throws Exception
>> +     * @throws Exception
>>      */
>>     public void testBuildFromMiddlePom() throws Exception
>>     {
>> @@ -156,23 +158,45 @@
>>         File f2 = getTestFile( "src/test/resources/projects/ 
>> grandchild-check/child/grandchild/pom.xml");
>>
>>         getProject( f1 );
>> -
>> +
>>         // it's the building of the grandchild project, having  
>> already cached the child project
>>         // (but not the parent project), which causes the problem.
>>         getProject( f2 );
>>     }
>> -
>> +
>>      public void testDuplicatePluginDefinitionsMerged()
>>          throws Exception
>>      {
>>          File f1 = getTestFile( "src/test/resources/projects/ 
>> duplicate-plugins-merged-pom.xml" );
>> -
>> +
>>          MavenProject project = getProject( f1 );
>> -
>> +
>>          assertEquals( 2, ( (Plugin) project.getBuildPlugins().get 
>> ( 0 ) ).getDependencies().size() );
>>      }
>> -
>> -	
>> +
>> +     public void  
>> testBuildDirectoryExpressionInterpolatedWithTranslatedValue()
>> +        throws Exception
>> +     {
>> +         File pom = getTestFile( "src/test/resources/projects/ 
>> build-path-expression-pom.xml" );
>> +
>> +         MavenProject project = getProject( pom );
>> +
>> +         Build build = project.getBuild();
>> +         assertNotNull( "Project should have a build section  
>> containing the test resource.", build );
>> +
>> +         String sourceDirectory = build.getSourceDirectory();
>> +         assertNotNull( "Project build should contain a valid  
>> source directory.", sourceDirectory );
>> +
>> +         List resources = build.getResources();
>> +         assertNotNull( "Project should contain a build  
>> resource.", resources );
>> +         assertEquals( "Project should contain exactly one build  
>> resource.", 1, resources.size() );
>> +
>> +         Resource res = (Resource) resources.get( 0 );
>> +         assertEquals( "Project resource should be the same  
>> directory as the source directory.", sourceDirectory,  
>> res.getDirectory() );
>> +
>> +         System.out.println( "Interpolated, translated resource  
>> directory is: " + res.getDirectory() );
>> +     }
>> +
>>     protected ArtifactRepository getLocalRepository()
>>         throws Exception
>>     {
>>
>> Added: maven/components/branches/maven-2.0.x/maven-project/src/ 
>> test/resources/projects/build-path-expression-pom.xml
>> URL: http://svn.apache.org/viewvc/maven/components/branches/ 
>> maven-2.0.x/maven-project/src/test/resources/projects/build-path- 
>> expression-pom.xml?rev=637324&view=auto
>> ===================================================================== 
>> =========
>> --- maven/components/branches/maven-2.0.x/maven-project/src/test/ 
>> resources/projects/build-path-expression-pom.xml (added)
>> +++ maven/components/branches/maven-2.0.x/maven-project/src/test/ 
>> resources/projects/build-path-expression-pom.xml Fri Mar 14  
>> 18:25:12 2008
>> @@ -0,0 +1,14 @@
>> +<project>
>> +  <modelVersion>4.0.0</modelVersion>
>> +  <groupId>org.apache.maven.project.tests</groupId>
>> +  <artifactId>build-path-expression</artifactId>
>> +  <version>1</version>
>> +  <build>
>> +    <sourceDirectory>sources</sourceDirectory>
>> +    <resources>
>> +      <resource>
>> +        <directory>${project.build.sourceDirectory}</directory>
>> +      </resource>
>> +    </resources>
>> +  </build>
>> +</project>
>> \ No newline at end of file
>>
>> Propchange: maven/components/branches/maven-2.0.x/maven-project/ 
>> src/test/resources/projects/build-path-expression-pom.xml
>> --------------------------------------------------------------------- 
>> ---------
>>    svn:eol-style = native
>>
>> Propchange: maven/components/branches/maven-2.0.x/maven-project/ 
>> src/test/resources/projects/build-path-expression-pom.xml
>> --------------------------------------------------------------------- 
>> ---------
>>    svn:keywords = "Author Date Id Revision"
>>
>>
>
> --
> Brett Porter
> brett@apache.org
> http://blogs.exist.com/bporter/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

---
John Casey
Committer and PMC Member, Apache Maven
mail: jdcasey at commonjava dot org
blog: http://www.ejlife.net/blogs/john
rss: http://feeds.feedburner.com/ejlife/john