o project builder takes a file now and not an input stream

o separated the construction of the domain model from the maven project


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@726951 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2008-12-16 04:40:59 +00:00
parent ff09f5beb7
commit 2dc15dda49
1 changed files with 33 additions and 15 deletions

View File

@ -21,7 +21,6 @@ package org.apache.maven.project.builder.impl;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -80,15 +79,12 @@ public final class DefaultProjectBuilder
{ {
} }
/** public PomClassicDomainModel buildModel( File pom, List<Model> inheritedModels,
* @see ProjectBuilder#buildFromLocalPath(java.io.InputStream, java.util.List, java.util.Collection, java.util.Collection, org.apache.maven.project.builder.PomArtifactResolver, java.io.File, org.apache.maven.project.ProjectBuilderConfiguration) Collection<ImportModel> importModels,
*/ Collection<InterpolatorProperty> interpolatorProperties,
public MavenProject buildFromLocalPath( File pom, List<Model> inheritedModels, PomArtifactResolver resolver, File projectDirectory,
Collection<ImportModel> importModels, ProjectBuilderConfiguration projectBuilderConfiguration )
Collection<InterpolatorProperty> interpolatorProperties, throws IOException
PomArtifactResolver resolver, File projectDirectory,
ProjectBuilderConfiguration projectBuilderConfiguration )
throws IOException
{ {
if ( pom == null ) if ( pom == null )
{ {
@ -143,14 +139,14 @@ public final class DefaultProjectBuilder
{ {
mavenParents = getDomainModelParentsFromRepository( domainModel, resolver ); mavenParents = getDomainModelParentsFromRepository( domainModel, resolver );
} }
if ( mavenParents.size() > 0 ) if ( mavenParents.size() > 0 )
{ {
PomClassicDomainModel dm = (PomClassicDomainModel) mavenParents.get( 0 ); PomClassicDomainModel dm = (PomClassicDomainModel) mavenParents.get( 0 );
parentFile = dm.getFile(); parentFile = dm.getFile();
domainModel.setParentFile( parentFile ); domainModel.setParentFile( parentFile );
} }
domainModels.addAll( mavenParents ); domainModels.addAll( mavenParents );
} }
@ -169,15 +165,37 @@ public final class DefaultProjectBuilder
transformer, transformer,
importModels, importModels,
properties, properties,
listeners ) ); listeners ) );
transformedDomainModel.setParentFile( parentFile );
return transformedDomainModel;
}
public MavenProject buildFromLocalPath( File pom, List<Model> inheritedModels,
Collection<ImportModel> importModels,
Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver, File projectDirectory,
ProjectBuilderConfiguration projectBuilderConfiguration )
throws IOException
{
PomClassicDomainModel domainModel = buildModel( pom,
inheritedModels,
importModels,
interpolatorProperties,
resolver,
projectDirectory,
projectBuilderConfiguration );
try try
{ {
MavenProject mavenProject = new MavenProject( transformedDomainModel.getModel(), MavenProject mavenProject = new MavenProject( domainModel.getModel(),
artifactFactory, artifactFactory,
mavenTools, mavenTools,
null, null,
projectBuilderConfiguration ); projectBuilderConfiguration );
mavenProject.setParentFile( parentFile );
mavenProject.setParentFile( domainModel.getParentFile() );
return mavenProject; return mavenProject;
} }
catch ( InvalidRepositoryException e ) catch ( InvalidRepositoryException e )