From 0638d3d8a088746a1a6e95fc8695151033f6b741 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Tue, 16 Dec 2008 05:19:39 +0000 Subject: [PATCH] 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 --- .../maven/project/builder/ProjectBuilder.java | 11 +++++++---- .../builder/impl/DefaultProjectBuilder.java | 17 +++++------------ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java index ed244094df..c433886158 100644 --- a/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java @@ -34,10 +34,11 @@ import java.util.*; */ public interface ProjectBuilder { - public PomClassicDomainModel buildModel( File pom, List inheritedModels, + public PomClassicDomainModel buildModel( File pom, + List inheritedModels, Collection importModels, Collection interpolatorProperties, - PomArtifactResolver resolver, File projectDirectory, + PomArtifactResolver resolver, ProjectBuilderConfiguration projectBuilderConfiguration ) throws IOException; @@ -53,9 +54,11 @@ public interface ProjectBuilder * @return a maven project for the specified input stream * @throws IOException if there is a problem in the construction of the maven project */ - MavenProject buildFromLocalPath( File pom, List inheritedModels, Collection importModels, + MavenProject buildFromLocalPath( File pom, + List inheritedModels, + Collection importModels, Collection interpolatorProperties, - PomArtifactResolver resolver, File baseDirectory, + PomArtifactResolver resolver, ProjectBuilderConfiguration projectBuilderConfiguration ) throws IOException; diff --git a/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java index bb812cd28e..5e345332ae 100644 --- a/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java @@ -42,7 +42,6 @@ import org.apache.maven.project.builder.PomClassicDomainModel; import org.apache.maven.project.builder.PomClassicDomainModelFactory; import org.apache.maven.project.builder.PomClassicTransformer; 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.shared.model.DomainModel; import org.apache.maven.shared.model.ImportModel; @@ -82,7 +81,7 @@ public final class DefaultProjectBuilder public PomClassicDomainModel buildModel( File pom, List inheritedModels, Collection importModels, Collection interpolatorProperties, - PomArtifactResolver resolver, File projectDirectory, + PomArtifactResolver resolver, ProjectBuilderConfiguration projectBuilderConfiguration ) throws IOException { @@ -96,11 +95,6 @@ public final class DefaultProjectBuilder throw new IllegalArgumentException( "resolver: null" ); } - if ( projectDirectory == null ) - { - throw new IllegalArgumentException( "projectDirectory: null" ); - } - if ( inheritedModels == null ) { inheritedModels = new ArrayList(); @@ -122,7 +116,7 @@ public final class DefaultProjectBuilder } PomClassicDomainModel domainModel = new PomClassicDomainModel( pom ); - domainModel.setProjectDirectory( projectDirectory ); + domainModel.setProjectDirectory( pom.getParentFile() ); List domainModels = new ArrayList(); domainModels.add( domainModel ); @@ -131,9 +125,9 @@ public final class DefaultProjectBuilder if ( domainModel.getModel().getParent() != null ) { List 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 { @@ -174,7 +168,7 @@ public final class DefaultProjectBuilder public MavenProject buildFromLocalPath( File pom, List inheritedModels, Collection importModels, Collection interpolatorProperties, - PomArtifactResolver resolver, File projectDirectory, + PomArtifactResolver resolver, ProjectBuilderConfiguration projectBuilderConfiguration ) throws IOException { @@ -183,7 +177,6 @@ public final class DefaultProjectBuilder importModels, interpolatorProperties, resolver, - projectDirectory, projectBuilderConfiguration ); try