maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject cvs commit: maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/t01 ProjectInheritanceTest.java
Date Fri, 08 Oct 2004 19:15:02 GMT
trygvis     2004/10/08 12:15:02

  Modified:    maven-core/src/main/java/org/apache/maven DefaultMaven.java
                        Maven.java MavenCli.java
               maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase
                        GoalMappingPhase.java GoalResolutionPhase.java
                        PluginResolutionPhase.java
               maven-core/src/main/java/org/apache/maven/plugin
                        PluginManager.java
               maven-core/src/main/java/org/apache/maven/project
                        DefaultMavenProjectBuilder.java
                        MavenProjectBuilder.java
               maven-core/src/main/java/org/apache/maven/util
                        AbstractGoalVisitor.java GoalVisitor.java
               maven-core/src/test/java/org/apache/maven MavenTestCase.java
               maven-core/src/test/java/org/apache/maven/lifecycle/goal/phase
                        GoalAssemblySubProcessTest.java
               maven-core/src/test/java/org/apache/maven/plugin
                        OgnlProjectValueExtractorTest.java
               maven-core/src/test/java/org/apache/maven/project
                        AbstractProjectTestCase.java
                        ProjectBaseDirectoryAlignmentTest.java
               maven-core/src/test/java/org/apache/maven/project/canonical
                        CanonicalProjectBuilderTest.java
               maven-core/src/test/java/org/apache/maven/project/inheritance
                        ProjectInheritanceTestCase.java
               maven-core/src/test/java/org/apache/maven/project/inheritance/t00
                        ProjectInheritanceTest.java
               maven-core/src/test/java/org/apache/maven/project/inheritance/t01
                        ProjectInheritanceTest.java
  Log:
  o Added mavenHomeLocal as a argument to the project builder. The project
    builder should now completly obey mavenHomeLocal.
  o Made mavenHome and mavenHomeLocal Files instead of Strings.
  o Adding licenses to some files missing license.
  o Silencing some eclipse warnings.
  
  Revision  Changes    Path
  1.13      +34 -24    maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
  
  Index: DefaultMaven.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultMaven.java	15 Sep 2004 12:34:16 -0000	1.12
  +++ DefaultMaven.java	8 Oct 2004 19:15:01 -0000	1.13
  @@ -16,6 +16,14 @@
    * limitations under the License.
    */
   
  +import java.io.File;
  +import java.util.ArrayList;
  +import java.util.Arrays;
  +import java.util.Date;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Map;
  +
   import org.apache.maven.lifecycle.goal.GoalNotFoundException;
   import org.apache.maven.lifecycle.session.MavenSession;
   import org.apache.maven.lifecycle.session.MavenSessionPhaseManager;
  @@ -24,6 +32,7 @@
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
   import org.apache.maven.project.ProjectBuildingException;
  +
   import org.codehaus.plexus.ArtifactEnabledContainer;
   import org.codehaus.plexus.PlexusConstants;
   import org.codehaus.plexus.context.Context;
  @@ -34,23 +43,15 @@
   import org.codehaus.plexus.util.FileUtils;
   import org.codehaus.plexus.util.StringUtils;
   
  -import java.io.File;
  -import java.util.ArrayList;
  -import java.util.Arrays;
  -import java.util.Date;
  -import java.util.Iterator;
  -import java.util.List;
  -import java.util.Map;
  -
   public class DefaultMaven
       extends AbstractLogEnabled
       implements Maven, Contextualizable
   {
       private ArtifactEnabledContainer container;
   
  -    private String mavenHome;
  +    private File mavenHome;
   
  -    private String mavenHomeLocal;
  +    private File mavenHomeLocal;
   
       private boolean logResults = true;
   
  @@ -183,9 +184,7 @@
   
           Runtime r = Runtime.getRuntime();
   
  -        getLogger().info(
  -            "Final Memory: " + ((r.totalMemory() - r.freeMemory()) / mb) + "M/" + (r.totalMemory() / mb) + "M" );
  -
  +        getLogger().info( "Final Memory: " + ((r.totalMemory() - r.freeMemory()) / mb) + "M/" + (r.totalMemory() / mb) + "M" );
       }
   
       private void line()
  @@ -197,8 +196,8 @@
       // Reactor execution
       // ----------------------------------------------------------------------
   
  -    public ExecutionResponse executeReactor( String goals, String includes, String excludes ) throws ReactorException,
  -        GoalNotFoundException
  +    public ExecutionResponse executeReactor( String goals, String includes, String excludes )
  +        throws ReactorException, GoalNotFoundException
       {
           List projects = new ArrayList();
   
  @@ -210,9 +209,9 @@
   
               for ( Iterator iterator = files.iterator(); iterator.hasNext(); )
               {
  -                File f = (File) iterator.next();
  +                File file = (File) iterator.next();
   
  -                MavenProject project = projectBuilder.build( f );
  +                MavenProject project = projectBuilder.build( getMavenHomeLocal(), file );
   
                   projects.add( project );
               }
  @@ -278,7 +277,8 @@
       // Project building
       // ----------------------------------------------------------------------
   
  -    public MavenProject getProject( File project ) throws ProjectBuildingException
  +    public MavenProject getProject( File project )
  +        throws ProjectBuildingException
       {
           if ( project.exists() )
           {
  @@ -288,7 +288,7 @@
               }
           }
   
  -        return projectBuilder.build( project );
  +        return projectBuilder.build( getMavenHomeLocal(), project );
       }
   
       // ----------------------------------------------------------------------
  @@ -301,26 +301,36 @@
       }
   
       // ----------------------------------------------------------------------
  -    // Maven home
  +    // Maven Configuration
       // ----------------------------------------------------------------------
   
  -    public void setMavenHome( String mavenHome )
  +    public void setMavenHome( File mavenHome )
       {
           this.mavenHome = mavenHome;
       }
   
  -    public String getMavenHome()
  +    public File getMavenHome()
       {
  +        if ( mavenHomeLocal == null )
  +        {
  +            throw new NullPointerException( "Maven home must be set." );
  +        }
  +
           return mavenHome;
       }
   
  -    public void setMavenHomeLocal( String mavenHomeLocal )
  +    public void setMavenHomeLocal( File mavenHomeLocal )
       {
           this.mavenHomeLocal = mavenHomeLocal;
       }
   
  -    public String getMavenHomeLocal()
  +    public File getMavenHomeLocal()
       {
  +        if ( mavenHomeLocal == null )
  +        {
  +            throw new NullPointerException( "Maven home local must be set." );
  +        }
  +
           return mavenHomeLocal;
       }
   
  
  
  
  1.6       +5 -5      maven-components/maven-core/src/main/java/org/apache/maven/Maven.java
  
  Index: Maven.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/Maven.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Maven.java	16 Sep 2004 16:06:13 -0000	1.5
  +++ Maven.java	8 Oct 2004 19:15:01 -0000	1.6
  @@ -67,13 +67,13 @@
       // Maven home
       // ----------------------------------------------------------------------
   
  -    void setMavenHome( String mavenHome );
  +    void setMavenHome( File mavenHome );
   
  -    String getMavenHome();
  +    File getMavenHome();
   
  -    void setMavenHomeLocal( String mavenHomeLocal );
  +    void setMavenHomeLocal( File mavenHomeLocal );
   
  -    String getMavenHomeLocal();
  +    File getMavenHomeLocal();
   
       // ----------------------------------------------------------------------
       // Maven project handling
  
  
  
  1.6       +16 -11    maven-components/maven-core/src/main/java/org/apache/maven/MavenCli.java
  
  Index: MavenCli.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/MavenCli.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MavenCli.java	10 Sep 2004 23:43:34 -0000	1.5
  +++ MavenCli.java	8 Oct 2004 19:15:01 -0000	1.6
  @@ -16,6 +16,10 @@
    * limitations under the License.
    */
   
  +import java.io.File;
  +import java.util.Iterator;
  +import java.util.TreeMap;
  +
   import org.apache.commons.cli.CommandLine;
   import org.apache.commons.cli.CommandLineParser;
   import org.apache.commons.cli.HelpFormatter;
  @@ -24,16 +28,9 @@
   import org.apache.commons.cli.ParseException;
   import org.apache.commons.cli.PosixParser;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
  +
   import org.codehaus.classworlds.ClassWorld;
   import org.codehaus.plexus.embed.ArtifactEnabledEmbedder;
  -import org.codehaus.plexus.embed.Embedder;
  -import org.codehaus.plexus.util.StringUtils;
  -
  -import java.io.File;
  -import java.io.FileInputStream;
  -import java.util.Iterator;
  -import java.util.Properties;
  -import java.util.TreeMap;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -62,9 +59,9 @@
   
           Maven maven = (Maven) embedder.lookup( Maven.ROLE );
   
  -        maven.setMavenHome( System.getProperty( "maven.home" ) );
  +        maven.setMavenHome( new File( System.getProperty( "maven.home" ) ) );
   
  -        maven.setMavenHomeLocal( System.getProperty( "maven.home.local", System.getProperty( "user.home" ) + "/.m2" ) );
  +        maven.setMavenHomeLocal( new File( System.getProperty( "maven.home.local", System.getProperty( "user.home" ) + "/.m2" ) ) );
   
           //---
   
  @@ -75,6 +72,14 @@
           if ( !projectFile.exists() )
           {
               projectFile = new File( System.getProperty( "user.dir" ), POMv3 );
  +
  +            if ( !projectFile.exists() )
  +            {
  +                System.err.println( "Could not find either a " + POMv4 + " nor a " + POMv3 + " project descriptor." );
  +
  +                // TODO: Use some constant for this value. Trygve.
  +                return 1;
  +            }
           }
   
           // ----------------------------------------------------------------------
  
  
  
  1.4       +17 -5     maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalMappingPhase.java
  
  Index: GoalMappingPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalMappingPhase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GoalMappingPhase.java	21 Sep 2004 23:38:30 -0000	1.3
  +++ GoalMappingPhase.java	8 Oct 2004 19:15:01 -0000	1.4
  @@ -1,21 +1,33 @@
  -/* Created on Sep 21, 2004 */
   package org.apache.maven.lifecycle.goal.phase;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import java.util.HashSet;
  -import java.util.Iterator;
  -import java.util.List;
   import java.util.Set;
   
   import org.apache.maven.lifecycle.goal.AbstractMavenGoalPhase;
   import org.apache.maven.lifecycle.goal.GoalExecutionException;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  -import org.apache.maven.lifecycle.goal.phase.PluginResolutionPhase.PluginResolutionVisitor;
   import org.apache.maven.lifecycle.session.MavenSession;
   import org.apache.maven.plugin.PluginManager;
  -import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.util.AbstractGoalVisitor;
   import org.apache.maven.util.GoalWalker;
   import org.apache.maven.util.GraphTraversalException;
  +
   import org.codehaus.plexus.util.dag.CycleDetectedException;
   
   /**
  
  
  
  1.6       +6 -15     maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalResolutionPhase.java
  
  Index: GoalResolutionPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/GoalResolutionPhase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GoalResolutionPhase.java	21 Sep 2004 23:11:16 -0000	1.5
  +++ GoalResolutionPhase.java	8 Oct 2004 19:15:01 -0000	1.6
  @@ -16,28 +16,19 @@
    * limitations under the License.
    */
   
  +import java.util.LinkedList;
  +import java.util.List;
  +import java.util.Map;
  +import java.util.TreeMap;
  +
   import org.apache.maven.lifecycle.goal.AbstractMavenGoalPhase;
   import org.apache.maven.lifecycle.goal.GoalExecutionException;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  -import org.apache.maven.lifecycle.goal.phase.PluginResolutionPhase.PluginResolutionVisitor;
   import org.apache.maven.lifecycle.session.MavenSession;
  -import org.apache.maven.model.GoalDecorator;
  -import org.apache.maven.model.PreGoal;
   import org.apache.maven.plugin.PluginManager;
  -import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.util.AbstractGoalVisitor;
   import org.apache.maven.util.GoalWalker;
   import org.apache.maven.util.GraphTraversalException;
  -import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
  -
  -import java.util.Collections;
  -import java.util.HashSet;
  -import java.util.Iterator;
  -import java.util.LinkedList;
  -import java.util.List;
  -import java.util.Map;
  -import java.util.Set;
  -import java.util.TreeMap;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
  
  
  
  1.2       +16 -9     maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/PluginResolutionPhase.java
  
  Index: PluginResolutionPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase/PluginResolutionPhase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PluginResolutionPhase.java	21 Sep 2004 23:11:16 -0000	1.1
  +++ PluginResolutionPhase.java	8 Oct 2004 19:15:01 -0000	1.2
  @@ -1,25 +1,32 @@
  -/* Created on Sep 21, 2004 */
   package org.apache.maven.lifecycle.goal.phase;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import java.util.HashSet;
  -import java.util.Iterator;
  -import java.util.LinkedList;
  -import java.util.List;
  -import java.util.Map;
   import java.util.Set;
  -import java.util.TreeMap;
   
   import org.apache.maven.lifecycle.goal.AbstractMavenGoalPhase;
   import org.apache.maven.lifecycle.goal.GoalExecutionException;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
   import org.apache.maven.lifecycle.session.MavenSession;
   import org.apache.maven.plugin.PluginManager;
  -import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.util.AbstractGoalVisitor;
   import org.apache.maven.util.GoalWalker;
   import org.apache.maven.util.GraphTraversalException;
  -import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
  -import org.codehaus.plexus.util.dag.CycleDetectedException;
   
   /**
    * @author jdcasey
  
  
  
  1.4       +3 -4      maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PluginManager.java	21 Sep 2004 23:11:16 -0000	1.3
  +++ PluginManager.java	8 Oct 2004 19:15:01 -0000	1.4
  @@ -16,11 +16,10 @@
    * limitations under the License.
    */
   
  +import java.util.Map;
  +
   import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
  -
  -import java.util.List;
  -import java.util.Map;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  
  
  
  1.18      +126 -84   maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
  
  Index: DefaultMavenProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DefaultMavenProjectBuilder.java	30 Sep 2004 14:48:07 -0000	1.17
  +++ DefaultMavenProjectBuilder.java	8 Oct 2004 19:15:01 -0000	1.18
  @@ -16,6 +16,21 @@
    * limitations under the License.
    */
   
  +import java.io.File;
  +import java.io.FileNotFoundException;
  +import java.io.FileReader;
  +import java.io.InputStreamReader;
  +import java.io.Reader;
  +import java.io.StringReader;
  +import java.io.StringWriter;
  +import java.util.ArrayList;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.LinkedList;
  +import java.util.List;
  +import java.util.Map;
  +import java.util.Set;
  +
   import org.apache.maven.artifact.Artifact;
   import org.apache.maven.artifact.DefaultArtifact;
   import org.apache.maven.artifact.MavenMetadataSource;
  @@ -34,27 +49,14 @@
   import org.apache.maven.project.validation.ModelValidationResult;
   import org.apache.maven.project.validation.ModelValidator;
   import org.apache.maven.repository.RepositoryUtils;
  +
   import org.codehaus.plexus.logging.AbstractLogEnabled;
   import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
  +import org.codehaus.plexus.util.IOUtil;
   import org.codehaus.plexus.util.StringUtils;
   import org.codehaus.plexus.util.dag.DAG;
   import org.codehaus.plexus.util.dag.TopologicalSorter;
   
  -import java.io.File;
  -import java.io.FileReader;
  -import java.io.IOException;
  -import java.io.InputStreamReader;
  -import java.io.Reader;
  -import java.io.StringReader;
  -import java.io.StringWriter;
  -import java.util.ArrayList;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.LinkedList;
  -import java.util.List;
  -import java.util.Map;
  -import java.util.Set;
  -
   public class DefaultMavenProjectBuilder
       extends AbstractLogEnabled
       implements MavenProjectBuilder, Initializable
  @@ -73,8 +75,6 @@
   
       private PathTranslator pathTranslator;
   
  -    private Model superModel;
  -
       public void initialize()
           throws Exception
       {
  @@ -83,10 +83,14 @@
           modelReader = new MavenXpp3Reader();
       }
   
  -    public MavenProject build( File projectDescriptor )
  +    // ----------------------------------------------------------------------
  +    // MavenProjectBuilder Implementation
  +    // ----------------------------------------------------------------------
  +
  +    public MavenProject build( File mavenLocalHome, File projectDescriptor )
           throws ProjectBuildingException
       {
  -        return build( projectDescriptor, false );
  +        return build( mavenLocalHome, projectDescriptor, false );
       }
   
       /** @todo can we move the super model reading to the initialize method? what about the user/site? Is it reused?
  @@ -94,51 +98,14 @@
        *  @todo we should be passing in some more configuration here so that maven home local can be used for user properties. Then, the new stuff should be unit tested.
        *  @todo the user model bit overwriting the super model seems a bit gross, but is needed so that any repositories given take affect
        */
  -    public MavenProject build( File projectDescriptor, boolean resolveDependencies )
  +    public MavenProject build( File mavenLocalHome, File projectDescriptor, boolean resolveDependencies )
           throws ProjectBuildingException
       {
  -        String localRepositoryValue = null;
  +        ArtifactRepository localRepository = getLocalRepository( mavenLocalHome );
   
           try
           {
  -            // TODO: rename to super-pom.xml so it is not used by the reactor
  -            superModel = modelReader.read( new InputStreamReader( DefaultMavenProjectBuilder.class.getResourceAsStream( "pom-4.0.0.xml" ) ) );
  -
  -            Model userModel = null;
  -            // TODO: use maven home local instead of user.home/.m2
  -            File userModelFile = new File( System.getProperty( "user.home" ) + "/.m2", "override.xml" );
  -            if ( userModelFile.exists() )
  -            {
  -                userModel = modelReader.read( new FileReader( userModelFile ) );
  -                if ( userModel.getParent() != null )
  -                {
  -                    throw new ProjectBuildingException( "Inheritence not supported in the user override POM" );
  -                }
  -
  -                if ( userModel.getLocal() != null && userModel.getLocal().getRepository() != null )
  -                {
  -                    localRepositoryValue = userModel.getLocal().getRepository();
  -                }
  -                superModel.getRepositories().addAll( userModel.getRepositories() );
  -            }
  -
  -            if ( localRepositoryValue == null && superModel.getLocal() != null && superModel.getLocal().getRepository() != null )
  -            {
  -                localRepositoryValue = superModel.getLocal().getRepository();
  -            }
  -
  -            localRepositoryValue = System.getProperty( "maven.repo.local", localRepositoryValue );
  -            System.setProperty( "maven.repo.local", localRepositoryValue );
  -
  -            ArtifactRepository localRepository = null;
  -            if ( localRepositoryValue != null )
  -            {
  -                localRepository = RepositoryUtils.localRepositoryToWagonRepository( localRepositoryValue );
  -            }
  -            else
  -            {
  -                throw new ProjectBuildingException( "A local repository must be specified" );
  -            }
  +            Model superModel = getSuperModel();
   
               LinkedList lineage = new LinkedList();
   
  @@ -156,6 +123,8 @@
                   previous = current;
               }
   
  +            Model userModel = getUserOverrideModel( superModel, mavenLocalHome );
  +
               if ( userModel != null )
               {
                   modelInheritanceAssembler.assembleModelInheritance( userModel, previous );
  @@ -236,15 +205,15 @@
   
           if ( parentModel != null )
           {
  -            if ( isEmpty( parentModel.getGroupId() ) )
  +            if ( StringUtils.isEmpty( parentModel.getGroupId() ) )
               {
                   throw new ProjectBuildingException( "Missing groupId element from parent element" );
               }
  -            else if ( isEmpty( parentModel.getArtifactId() ) )
  +            else if ( StringUtils.isEmpty( parentModel.getArtifactId() ) )
               {
                   throw new ProjectBuildingException( "Missing artifactId element from parent element" );
               }
  -            else if ( isEmpty( parentModel.getVersion() ) )
  +            else if ( StringUtils.isEmpty( parentModel.getVersion() ) )
               {
                   throw new ProjectBuildingException( "Missing version element from parent element" );
               }
  @@ -281,33 +250,32 @@
       }
   
       private Model readModel( File projectDescriptor )
  -        throws Exception
  +        throws ProjectBuildingException
       {
  -        Reader reader = null;
  -
           try
           {
  -            reader = new FileReader( projectDescriptor );
  -
  -            Model model = modelReader.read( reader );
  -
  -            reader.close();
  +            return readModel( new FileReader( projectDescriptor ) );
  +        }
  +        catch( FileNotFoundException ex )
  +        {
  +            throw new ProjectBuildingException( "Error while building model.", ex );
  +        }
  +    }
   
  -            return model;
  +    private Model readModel( Reader reader )
  +        throws ProjectBuildingException
  +    {
  +        try
  +        {
  +            return modelReader.read( reader );
  +        }
  +        catch( Exception ex )
  +        {
  +            throw new ProjectBuildingException( "Error while building model.", ex );
           }
           finally
           {
  -            if ( reader != null )
  -            {
  -                try
  -                {
  -                    reader.close();
  -                }
  -                catch ( IOException e )
  -                {
  -                    // ignore
  -                }
  -            }
  +            IOUtil.close( reader );
           }
       }
   
  @@ -411,8 +379,82 @@
           return sortedProjects;
       }
   
  -    private boolean isEmpty( String string )
  +    // ----------------------------------------------------------------------
  +    //
  +    // ----------------------------------------------------------------------
  +
  +    /**
  +     * Locate the local repository.
  +     * 
  +     * <ol>
  +     *  <li>Try ${maven.repo.local}
  +     *  <li>Look in mavenHomeLocal/override.xml
  +     *  <li>Set to the default value (${user.home}/.m2/repository).
  +     * </ol>
  +     * 
  +     * @param mavenHomeLocal The maven local home directory
  +     * @return Returns the local repository
  +     * @throws ProjectBuildingException
  +     */
  +    protected ArtifactRepository getLocalRepository( File mavenHomeLocal )
  +        throws ProjectBuildingException
       {
  -        return string == null || string.trim().length() == 0;
  +        String localRepository = System.getProperty( "maven.repo.local" );
  +
  +        Model superModel = getSuperModel();
  +
  +        if ( !StringUtils.isEmpty( localRepository ) )
  +        {
  +            return RepositoryUtils.localRepositoryToWagonRepository( localRepository );
  +        }
  +
  +        if ( superModel.getLocal() != null && superModel.getLocal().getRepository() != null )
  +        {
  +            localRepository = superModel.getLocal().getRepository();
  +        }
  +
  +        Model userModel = getUserOverrideModel( superModel, mavenHomeLocal );
  +
  +        if ( userModel != null && userModel.getLocal() != null && userModel.getLocal().getRepository() != null )
  +        {
  +            localRepository = userModel.getLocal().getRepository();
  +        }
  +
  +        if ( localRepository == null )
  +        {
  +            String userHome = System.getProperty( "user.home" );
  +
  +            localRepository = new File( userHome, ".m2/repository" ).getAbsolutePath();
  +        }
  +
  +        return RepositoryUtils.localRepositoryToWagonRepository( localRepository );
  +    }
  +
  +    private Model getSuperModel()
  +        throws ProjectBuildingException
  +    {
  +        return readModel( new InputStreamReader( DefaultMavenProjectBuilder.class.getResourceAsStream( "pom-4.0.0.xml" ) ) );
  +    }
  +
  +    private Model getUserOverrideModel( Model superModel, File mavenHomeLocal )
  +        throws ProjectBuildingException
  +    {
  +        File userModelFile = new File( mavenHomeLocal, "override.xml" );
  +
  +        if ( !userModelFile.exists() )
  +        {
  +            return null;
  +        }
  +
  +        Model model = readModel( userModelFile );
  +
  +        if ( model.getParent() != null )
  +        {
  +            throw new ProjectBuildingException( "Inheritence not supported in the user override POM" );
  +        }
  +
  +        superModel.getRepositories().addAll( model.getRepositories() );
  +
  +        return model;
       }
   }
  
  
  
  1.3       +2 -2      maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
  
  Index: MavenProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProjectBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MavenProjectBuilder.java	2 Sep 2004 12:34:17 -0000	1.2
  +++ MavenProjectBuilder.java	8 Oct 2004 19:15:01 -0000	1.3
  @@ -25,10 +25,10 @@
   
       // ----------------------------------------------------------------------
   
  -    MavenProject build( File project )
  +    MavenProject build( File mavenHomeLocal, File project )
           throws ProjectBuildingException;
   
  -    MavenProject build( File project, boolean followTransitiveDeps )
  +    MavenProject build( File mavenHomeLocal, File project, boolean followTransitiveDeps )
           throws ProjectBuildingException;
   
       // ----------------------------------------------------------------------
  
  
  
  1.2       +16 -2     maven-components/maven-core/src/main/java/org/apache/maven/util/AbstractGoalVisitor.java
  
  Index: AbstractGoalVisitor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/util/AbstractGoalVisitor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractGoalVisitor.java	21 Sep 2004 23:11:16 -0000	1.1
  +++ AbstractGoalVisitor.java	8 Oct 2004 19:15:01 -0000	1.2
  @@ -1,8 +1,22 @@
  -/* Created on Sep 21, 2004 */
   package org.apache.maven.util;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import org.apache.maven.lifecycle.session.MavenSession;
  -import org.apache.maven.plugin.descriptor.MojoDescriptor;
   
   /**
    * @author jdcasey
  
  
  
  1.2       +16 -2     maven-components/maven-core/src/main/java/org/apache/maven/util/GoalVisitor.java
  
  Index: GoalVisitor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/util/GoalVisitor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GoalVisitor.java	21 Sep 2004 23:11:16 -0000	1.1
  +++ GoalVisitor.java	8 Oct 2004 19:15:01 -0000	1.2
  @@ -1,8 +1,22 @@
  -/* Created on Sep 21, 2004 */
   package org.apache.maven.util;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import org.apache.maven.lifecycle.session.MavenSession;
  -import org.apache.maven.plugin.descriptor.MojoDescriptor;
   
   /**
    * @author jdcasey
  
  
  
  1.9       +44 -27    maven-components/maven-core/src/test/java/org/apache/maven/MavenTestCase.java
  
  Index: MavenTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/MavenTestCase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MavenTestCase.java	22 Sep 2004 00:23:35 -0000	1.8
  +++ MavenTestCase.java	8 Oct 2004 19:15:01 -0000	1.9
  @@ -16,20 +16,18 @@
    * limitations under the License.
    */
   
  +import java.io.File;
  +import java.util.ArrayList;
  +import java.util.List;
  +
   import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
   import org.apache.maven.lifecycle.session.MavenSession;
   import org.apache.maven.plugin.PluginManager;
  -import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
  -import org.codehaus.classworlds.ClassRealm;
  -import org.codehaus.classworlds.ClassWorld;
  -import org.codehaus.plexus.ArtifactEnabledPlexusTestCase;
   
  -import java.io.File;
  -import java.util.ArrayList;
  -import java.util.List;
  +import org.codehaus.plexus.ArtifactEnabledPlexusTestCase;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
  @@ -44,11 +42,17 @@
   
       protected String testRepoUrl;
   
  -    protected void setUp() throws Exception
  +    private File mavenHome = new File( getBasedir(), "target/maven.home" );
  +
  +    private File mavenLocalHome = new File( getBasedir(), "target/maven.home.local" );;
  +
  +    protected void setUp()
  +        throws Exception
       {
           super.setUp();
   
           File testRepoLocation = new File( "target/repo" );
  +
           if ( !testRepoLocation.exists() )
           {
               testRepoLocation.mkdirs();
  @@ -62,42 +66,55 @@
           projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
       }
   
  +    // ----------------------------------------------------------------------
  +    // Customizing the PlexusTestCase
  +    // ----------------------------------------------------------------------
  +
  +    protected void customizeContext()
  +        throws Exception
  +    {
  +        MavenTestUtils.customizeContext( getContainer(), getTestFile( "" ), mavenHome, mavenLocalHome );
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    // 
  +    // ----------------------------------------------------------------------
  +
       protected String getTestRepoURL()
       {
           return testRepoUrl;
       }
   
  -    protected void customizeContext() throws Exception
  +    protected File getMavenHome()
       {
  -        ClassWorld classWorld = new ClassWorld();
  -
  -        ClassRealm rootClassRealm = classWorld.newRealm( "root", Thread.currentThread().getContextClassLoader() );
  -
  -        getContainer().addContextValue( "rootClassRealm", rootClassRealm );
  -
  -        // TODO: are these used? Are they correct?
  -        getContainer().addContextValue( "maven.home", new File( getBasedir(), "target/maven.home" ).getPath() );
  +        return mavenHome;
  +    }
   
  -        getContainer().addContextValue( "maven.home.local",
  -            new File( getBasedir(), "target/maven.home.local" ).getPath() );
  +    protected File getMavenLocalHome()
  +    {
  +        return mavenLocalHome;
       }
   
  -    protected MavenGoalExecutionContext createGoalExecutionContext() throws Exception
  +    protected MavenGoalExecutionContext createGoalExecutionContext()
  +        throws Exception
       {
           return createGoalExecutionContext( null, null );
       }
   
  -    protected MavenGoalExecutionContext createGoalExecutionContext( File pom ) throws Exception
  +    protected MavenGoalExecutionContext createGoalExecutionContext( File pom )
  +        throws Exception
       {
           return createGoalExecutionContext( pom, null );
       }
   
  -    protected MavenGoalExecutionContext createGoalExecutionContext( String goal ) throws Exception
  +    protected MavenGoalExecutionContext createGoalExecutionContext( String goal )
  +        throws Exception
       {
           return createGoalExecutionContext( null, goal );
       }
   
  -    protected MavenGoalExecutionContext createGoalExecutionContext( File pom, String goal ) throws Exception
  +    protected MavenGoalExecutionContext createGoalExecutionContext( File pom, String goal )
  +        throws Exception
       {
           ArtifactRepository localRepository = new ArtifactRepository( "local", testRepoUrl );
   
  @@ -105,13 +122,13 @@
   
           if ( pom != null )
           {
  -            project = projectBuilder.build( pom );
  +            project = projectBuilder.build( mavenLocalHome, pom );
           }
           else
           {
  -            File f = new File( basedir, "target/test-classes/pom.xml" );
  +            File f = getTestFile( "target/test-classes/pom.xml" );
   
  -            project = projectBuilder.build( f );
  +            project = projectBuilder.build( mavenLocalHome, f );
           }
   
           return createGoalExecutionContext( project, localRepository, goal );
  
  
  
  1.2       +23 -9     maven-components/maven-core/src/test/java/org/apache/maven/lifecycle/goal/phase/GoalAssemblySubProcessTest.java
  
  Index: GoalAssemblySubProcessTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/lifecycle/goal/phase/GoalAssemblySubProcessTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GoalAssemblySubProcessTest.java	21 Sep 2004 23:11:16 -0000	1.1
  +++ GoalAssemblySubProcessTest.java	8 Oct 2004 19:15:01 -0000	1.2
  @@ -1,14 +1,20 @@
  -/* Created on Jul 14, 2004 */
   package org.apache.maven.lifecycle.goal.phase;
   
  -import org.apache.maven.MavenTestCase;
  -import org.apache.maven.artifact.repository.ArtifactRepository;
  -import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  -import org.apache.maven.lifecycle.session.MavenSession;
  -import org.apache.maven.model.Model;
  -import org.apache.maven.model.PostGoal;
  -import org.apache.maven.model.PreGoal;
  -import org.apache.maven.project.MavenProject;
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   
   import java.util.ArrayList;
   import java.util.Collections;
  @@ -17,6 +23,14 @@
   import java.util.List;
   import java.util.Map;
   import java.util.TreeMap;
  +
  +import org.apache.maven.MavenTestCase;
  +import org.apache.maven.artifact.repository.ArtifactRepository;
  +import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
  +import org.apache.maven.model.Model;
  +import org.apache.maven.model.PostGoal;
  +import org.apache.maven.model.PreGoal;
  +import org.apache.maven.project.MavenProject;
   
   /** The point of this test class is to check out the functioning of the 
    * plugin resolution, goal mapping, and goal resolution phases. These are 
  
  
  
  1.6       +6 -6      maven-components/maven-core/src/test/java/org/apache/maven/plugin/OgnlProjectValueExtractorTest.java
  
  Index: OgnlProjectValueExtractorTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/plugin/OgnlProjectValueExtractorTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- OgnlProjectValueExtractorTest.java	2 Sep 2004 12:34:18 -0000	1.5
  +++ OgnlProjectValueExtractorTest.java	8 Oct 2004 19:15:01 -0000	1.6
  @@ -1,13 +1,13 @@
   package org.apache.maven.plugin;
   
  +import java.io.File;
  +
   import org.apache.maven.MavenTestCase;
   import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.lifecycle.goal.MavenGoalExecutionContext;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
   
  -import java.io.File;
  -
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
  @@ -28,9 +28,9 @@
   
           builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
   
  -        File f =  new File( basedir, "src/test/resources/pom.xml" );
  +        File f =  getTestFile( "src/test/resources/pom.xml" );
   
  -        project = builder.build( f );
  +        project = builder.build( getMavenLocalHome(), f );
   
           context = createGoalExecutionContext();
       }
  @@ -40,7 +40,7 @@
       {
           Object value = OgnlProjectValueExtractor.evaluate( "#project.build.directory/classes", context );
   
  -        String expected = new File( basedir, "target/test-classes/target/classes" ).getCanonicalPath();
  +        String expected = getTestFile( "target/test-classes/target/classes" ).getCanonicalPath();
   
           String actual = new File( value.toString() ).getCanonicalPath();
   
  
  
  
  1.5       +2 -2      maven-components/maven-core/src/test/java/org/apache/maven/project/AbstractProjectTestCase.java
  
  Index: AbstractProjectTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/AbstractProjectTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractProjectTestCase.java	15 Sep 2004 12:30:05 -0000	1.4
  +++ AbstractProjectTestCase.java	8 Oct 2004 19:15:01 -0000	1.5
  @@ -31,12 +31,12 @@
           return localRepository;
       }
   
  -    protected MavenProject buildProject( File f, boolean followTransitiveDeps )
  +    protected MavenProject buildProject( File file, boolean followTransitiveDeps )
          throws Exception
       {
           MavenProject project;
   
  -        project = projectBuilder.build( f, followTransitiveDeps );
  +        project = projectBuilder.build( getMavenLocalHome(), file, followTransitiveDeps );
   
           assertNotNull( "Project is null", project );
   
  
  
  
  1.4       +5 -5      maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectBaseDirectoryAlignmentTest.java
  
  Index: ProjectBaseDirectoryAlignmentTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectBaseDirectoryAlignmentTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProjectBaseDirectoryAlignmentTest.java	15 Sep 2004 12:30:05 -0000	1.3
  +++ ProjectBaseDirectoryAlignmentTest.java	8 Oct 2004 19:15:01 -0000	1.4
  @@ -14,21 +14,21 @@
       public void testProjectDirectoryBaseDirectoryAlignment()
           throws Exception
       {
  -        File f = new File( basedir, dir + "project-which-needs-directory-alignment.xml" );
  +        File f = getTestFile( dir + "project-which-needs-directory-alignment.xml" );
           
  -        MavenProject project = projectBuilder.build( f, false );
  +        MavenProject project = projectBuilder.build( getMavenLocalHome(), f, false );
   
           assertNotNull( "Test project can't be null!", project );
   
  -        assertTrue( project.getBuild().getSourceDirectory().startsWith( basedir ) );
  +        assertTrue( project.getBuild().getSourceDirectory().startsWith( getBasedir() ) );
   
  -        assertTrue( project.getBuild().getUnitTestSourceDirectory().startsWith( basedir ) );
  +        assertTrue( project.getBuild().getUnitTestSourceDirectory().startsWith( getBasedir() ) );
   
           Build build = project.getBuild();
   
           Resource resource = (Resource) build.getResources().get( 0 );
   
  -        assertTrue( resource.getDirectory().startsWith( basedir ) );
  +        assertTrue( resource.getDirectory().startsWith( getBasedir() ) );
       }
   
       /* TODO: why commented out? Gives a Wagonhttp warning and can't find parent POM
  
  
  
  1.3       +8 -19     maven-components/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java
  
  Index: CanonicalProjectBuilderTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CanonicalProjectBuilderTest.java	3 Oct 2004 19:28:25 -0000	1.2
  +++ CanonicalProjectBuilderTest.java	8 Oct 2004 19:15:01 -0000	1.3
  @@ -16,26 +16,15 @@
    * limitations under the License.
    */
   
  -import junit.framework.TestCase;
  -import org.apache.maven.model.Build;
  -import org.apache.maven.model.Contributor;
  -import org.apache.maven.model.Dependency;
  -import org.apache.maven.model.Developer;
  -import org.apache.maven.model.DistributionManagement;
  -import org.apache.maven.model.MailingList;
  -import org.apache.maven.model.Repository;
  -import org.apache.maven.model.Resource;
  -import org.apache.maven.model.Site;
  -import org.apache.maven.model.UnitTest;
  -import org.apache.maven.model.Plugin;
  -import org.apache.maven.model.Goal;
  -import org.apache.maven.project.MavenProject;
  -import org.apache.maven.MavenTestCase;
  -
   import java.io.File;
   import java.util.List;
   import java.util.Properties;
   
  +import org.apache.maven.MavenTestCase;
  +import org.apache.maven.model.Goal;
  +import org.apache.maven.model.Plugin;
  +import org.apache.maven.project.MavenProject;
  +
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
    * @version $Id$
  @@ -46,9 +35,9 @@
       public void testProjectBuilder()
           throws Exception
       {
  -        File f  = new File( basedir, "src/test/resources/canonical-pom.xml" );
  +        File f  = getTestFile( "src/test/resources/canonical-pom.xml" );
   
  -        MavenProject project = projectBuilder.build( f );
  +        MavenProject project = projectBuilder.build( getMavenLocalHome(), f );
   
           // ----------------------------------------------------------------------
           // Top-level elements
  
  
  
  1.4       +5 -7      maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/ProjectInheritanceTestCase.java
  
  Index: ProjectInheritanceTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/ProjectInheritanceTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProjectInheritanceTestCase.java	15 Sep 2004 12:30:05 -0000	1.3
  +++ ProjectInheritanceTestCase.java	8 Oct 2004 19:15:01 -0000	1.4
  @@ -31,18 +31,16 @@
   
           projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
   
  -        System.setProperty( "maven.repo.local", getLocalRepository() );
  +        System.setProperty( "maven.repo.local", getLocalRepository().getAbsolutePath() );
       }
   
  -    private String getLocalRepository()
  +    private File getLocalRepository()
       {
  -        return new File( basedir, "src/test/resources/inheritance-repo/" + getTestSeries() ).getPath();
  +        return getTestFile( "src/test/resources/inheritance-repo/" + getTestSeries() );
       }
   
       protected File projectFile( String name )
       {
  -        File f = new File( "src/test/resources/inheritance-repo/" + getTestSeries() + "/maven/poms", name + "-1.0.pom" );
  -
  -        return new File( basedir, f.getPath() );
  +        return new File( getLocalRepository(), "/maven/poms/" + name + "-1.0.pom" );
       }
   }
  
  
  
  1.3       +2 -2      maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java
  
  Index: ProjectInheritanceTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProjectInheritanceTest.java	2 Sep 2004 12:34:18 -0000	1.2
  +++ ProjectInheritanceTest.java	8 Oct 2004 19:15:02 -0000	1.3
  @@ -36,7 +36,7 @@
       public void testProjectInheritance()
           throws Exception
       {
  -        MavenProject p4 = projectBuilder.build( projectFile( "p4" ) );
  +        MavenProject p4 = projectBuilder.build( getMavenLocalHome(), projectFile( "p4" ) );
   
           assertEquals( "p4", p4.getName() );
   
  
  
  
  1.4       +6 -6      maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java
  
  Index: ProjectInheritanceTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProjectInheritanceTest.java	15 Sep 2004 12:30:05 -0000	1.3
  +++ ProjectInheritanceTest.java	8 Oct 2004 19:15:02 -0000	1.4
  @@ -38,7 +38,7 @@
           // Check p0 value for org name
           // ----------------------------------------------------------------------
   
  -        MavenProject p0 = projectBuilder.build( projectFile( "p0" ) );
  +        MavenProject p0 = projectBuilder.build( getMavenLocalHome(), projectFile( "p0" ) );
   
           assertEquals( "p0-org", p0.getOrganization().getName() );
   
  @@ -46,7 +46,7 @@
           // Check p1 value for org name
           // ----------------------------------------------------------------------
   
  -        MavenProject p1 = projectBuilder.build( projectFile( "p1" ) );
  +        MavenProject p1 = projectBuilder.build( getMavenLocalHome(), projectFile( "p1" ) );
   
           assertEquals( "p1-org", p1.getOrganization().getName() );
   
  @@ -54,7 +54,7 @@
           // Check p2 value for org name
           // ----------------------------------------------------------------------
   
  -        MavenProject p2 = projectBuilder.build( projectFile( "p2" ) );
  +        MavenProject p2 = projectBuilder.build( getMavenLocalHome(), projectFile( "p2" ) );
   
           assertEquals( "p2-org", p2.getOrganization().getName() );
   
  @@ -62,7 +62,7 @@
           // Check p2 value for org name
           // ----------------------------------------------------------------------
   
  -        MavenProject p3 = projectBuilder.build( projectFile( "p3" ) );
  +        MavenProject p3 = projectBuilder.build( getMavenLocalHome(), projectFile( "p3" ) );
   
           assertEquals( "p3-org", p3.getOrganization().getName() );
   
  @@ -70,7 +70,7 @@
           // Check p4 value for org name
           // ----------------------------------------------------------------------
   
  -        MavenProject p4 = projectBuilder.build( projectFile( "p4" ) );
  +        MavenProject p4 = projectBuilder.build( getMavenLocalHome(), projectFile( "p4" ) );
   
           assertEquals( "p4-org", p4.getOrganization().getName() );
       }
  
  
  

Mime
View raw message