o passing in the file, we don't need the parent directory

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@726961 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2008-12-16 05:19:39 +00:00
parent 75456d77ba
commit 0638d3d8a0
2 changed files with 12 additions and 16 deletions

View File

@ -34,10 +34,11 @@ import java.util.*;
*/ */
public interface ProjectBuilder public interface ProjectBuilder
{ {
public PomClassicDomainModel buildModel( File pom, List<Model> inheritedModels, public PomClassicDomainModel buildModel( File pom,
List<Model> inheritedModels,
Collection<ImportModel> importModels, Collection<ImportModel> importModels,
Collection<InterpolatorProperty> interpolatorProperties, Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver, File projectDirectory, PomArtifactResolver resolver,
ProjectBuilderConfiguration projectBuilderConfiguration ) ProjectBuilderConfiguration projectBuilderConfiguration )
throws IOException; throws IOException;
@ -53,9 +54,11 @@ public interface ProjectBuilder
* @return a maven project for the specified input stream * @return a maven project for the specified input stream
* @throws IOException if there is a problem in the construction of the maven project * @throws IOException if there is a problem in the construction of the maven project
*/ */
MavenProject buildFromLocalPath( File pom, List<Model> inheritedModels, Collection<ImportModel> importModels, MavenProject buildFromLocalPath( File pom,
List<Model> inheritedModels,
Collection<ImportModel> importModels,
Collection<InterpolatorProperty> interpolatorProperties, Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver, File baseDirectory, PomArtifactResolver resolver,
ProjectBuilderConfiguration projectBuilderConfiguration ) ProjectBuilderConfiguration projectBuilderConfiguration )
throws IOException; throws IOException;

View File

@ -42,7 +42,6 @@ import org.apache.maven.project.builder.PomClassicDomainModel;
import org.apache.maven.project.builder.PomClassicDomainModelFactory; import org.apache.maven.project.builder.PomClassicDomainModelFactory;
import org.apache.maven.project.builder.PomClassicTransformer; import org.apache.maven.project.builder.PomClassicTransformer;
import org.apache.maven.project.builder.ProjectBuilder; import org.apache.maven.project.builder.ProjectBuilder;
import org.apache.maven.project.validation.ModelValidationResult;
import org.apache.maven.project.validation.ModelValidator; import org.apache.maven.project.validation.ModelValidator;
import org.apache.maven.shared.model.DomainModel; import org.apache.maven.shared.model.DomainModel;
import org.apache.maven.shared.model.ImportModel; import org.apache.maven.shared.model.ImportModel;
@ -82,7 +81,7 @@ public final class DefaultProjectBuilder
public PomClassicDomainModel buildModel( File pom, List<Model> inheritedModels, public PomClassicDomainModel buildModel( File pom, List<Model> inheritedModels,
Collection<ImportModel> importModels, Collection<ImportModel> importModels,
Collection<InterpolatorProperty> interpolatorProperties, Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver, File projectDirectory, PomArtifactResolver resolver,
ProjectBuilderConfiguration projectBuilderConfiguration ) ProjectBuilderConfiguration projectBuilderConfiguration )
throws IOException throws IOException
{ {
@ -96,11 +95,6 @@ public final class DefaultProjectBuilder
throw new IllegalArgumentException( "resolver: null" ); throw new IllegalArgumentException( "resolver: null" );
} }
if ( projectDirectory == null )
{
throw new IllegalArgumentException( "projectDirectory: null" );
}
if ( inheritedModels == null ) if ( inheritedModels == null )
{ {
inheritedModels = new ArrayList<Model>(); inheritedModels = new ArrayList<Model>();
@ -122,7 +116,7 @@ public final class DefaultProjectBuilder
} }
PomClassicDomainModel domainModel = new PomClassicDomainModel( pom ); PomClassicDomainModel domainModel = new PomClassicDomainModel( pom );
domainModel.setProjectDirectory( projectDirectory ); domainModel.setProjectDirectory( pom.getParentFile() );
List<DomainModel> domainModels = new ArrayList<DomainModel>(); List<DomainModel> domainModels = new ArrayList<DomainModel>();
domainModels.add( domainModel ); domainModels.add( domainModel );
@ -131,9 +125,9 @@ public final class DefaultProjectBuilder
if ( domainModel.getModel().getParent() != null ) if ( domainModel.getModel().getParent() != null )
{ {
List<DomainModel> mavenParents; List<DomainModel> mavenParents;
if ( isParentLocal( domainModel.getModel().getParent(), projectDirectory ) ) if ( isParentLocal( domainModel.getModel().getParent(), pom.getParentFile() ) )
{ {
mavenParents = getDomainModelParentsFromLocalPath( domainModel, resolver, projectDirectory ); mavenParents = getDomainModelParentsFromLocalPath( domainModel, resolver, pom.getParentFile() );
} }
else else
{ {
@ -174,7 +168,7 @@ public final class DefaultProjectBuilder
public MavenProject buildFromLocalPath( File pom, List<Model> inheritedModels, public MavenProject buildFromLocalPath( File pom, List<Model> inheritedModels,
Collection<ImportModel> importModels, Collection<ImportModel> importModels,
Collection<InterpolatorProperty> interpolatorProperties, Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver, File projectDirectory, PomArtifactResolver resolver,
ProjectBuilderConfiguration projectBuilderConfiguration ) ProjectBuilderConfiguration projectBuilderConfiguration )
throws IOException throws IOException
{ {
@ -183,7 +177,6 @@ public final class DefaultProjectBuilder
importModels, importModels,
interpolatorProperties, interpolatorProperties,
resolver, resolver,
projectDirectory,
projectBuilderConfiguration ); projectBuilderConfiguration );
try try