o fixinga bunch of embedder tests, 8 left to fix

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@774768 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-05-14 13:52:03 +00:00
parent 060c6d9784
commit 7ccc3d878e
6 changed files with 52 additions and 21 deletions

View File

@ -126,7 +126,7 @@ public class DefaultMaven
try
{
ProjectSorter projectSorter = new ProjectSorter( projects.values() );
session = new MavenSession( container, request, result, projectSorter.getSortedProjects() );
}
catch ( CycleDetectedException e )
@ -163,7 +163,7 @@ public class DefaultMaven
}
result.setTopologicallySortedProjects( session.getProjects() );
result.setProject( session.getTopLevelProject() );
return result;

View File

@ -71,8 +71,9 @@ public class MavenSession
if ( projects.size() > 0 )
{
this.currentProject = projects.get( 0 );
this.topLevelProject = projects.get( 0 );
}
this.projects = projects;
this.projects = projects;
}
@Deprecated

View File

@ -106,7 +106,7 @@ public class DefaultMavenProjectBuilder
public MavenProject build( File pomFile, ProjectBuilderConfiguration configuration )
throws ProjectBuildingException
{
{
MavenProject project = projectCache.get( pomFile.getAbsolutePath() );
if ( project != null )

View File

@ -24,22 +24,24 @@ import org.apache.maven.profiles.ProfileManager;
public interface MavenProjectBuilder
{
// site
MavenProject build( File project, ArtifactRepository localRepository, ProfileManager profileManager )
throws ProjectBuildingException;
// remote-resources-plugin
MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
throws ProjectBuildingException;
MavenProject build( File project, ProjectBuilderConfiguration configuration )
MavenProject build( File projectFile, ProjectBuilderConfiguration configuration )
throws ProjectBuildingException;
MavenProject buildFromRepository( Artifact projectArtifact, ProjectBuilderConfiguration configuration )
throws ProjectBuildingException;
//TODO maven-site-plugin
MavenProject build( File project, ArtifactRepository localRepository, ProfileManager profileManager )
throws ProjectBuildingException;
//TODO remote-resources-plugin
MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
throws ProjectBuildingException;
// TODO: This also doesn't really belong here as it's a mix of project builder and artifact resolution and belongs
// in an integration component like the embedder.
MavenProjectBuildingResult buildProjectWithDependencies( File project, ProjectBuilderConfiguration configuration )
throws ProjectBuildingException;
MavenProject buildFromRepository( Artifact artifact, ProjectBuilderConfiguration configuration )
throws ProjectBuildingException;
// TODO: this is only to provide a project for plugins that don't need a project to execute but need some
// of the values from a MavenProject. Ideally this should be something internal and nothing outside Maven

View File

@ -514,7 +514,6 @@ public class MavenEmbedder
public boolean isOffline( MavenExecutionRequest request )
throws MavenEmbedderException
{
// first, grab defaults including settings, in case <offline>true</offline> is set.
request = populator.populateDefaults( request, configuration );
return request.isOffline();
@ -525,9 +524,7 @@ public class MavenEmbedder
LoggerManager loggerManager = container.getLoggerManager();
int oldThreshold = loggerManager.getThreshold();
try
{
loggerManager.setThresholds( request.getLoggingLevel() );

View File

@ -22,6 +22,7 @@ import java.util.List;
import java.util.Properties;
import java.util.Set;
import org.apache.maven.Maven;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.embedder.Configuration;
@ -72,6 +73,8 @@ public class DefaultMavenExecutionRequestPopulator
{
executionProperties( request, configuration );
pom( request, configuration );
settings( request, configuration );
localRepository( request, configuration );
@ -81,7 +84,7 @@ public class DefaultMavenExecutionRequestPopulator
profileManager( request, configuration );
processSettings( request, configuration );
return request;
}
@ -113,6 +116,34 @@ public class DefaultMavenExecutionRequestPopulator
}
}
}
private void pom( MavenExecutionRequest request, Configuration configuration )
{
// ------------------------------------------------------------------------
// POM
//
// If we are not given a specific POM file, but passed a base directory
// then we will use a release POM in the directory provide, or and then
// look for the standard POM.
// ------------------------------------------------------------------------
if ( ( request.getPom() != null ) && ( request.getPom().getParentFile() != null ) )
{
request.setBaseDirectory( request.getPom().getParentFile() );
}
else if ( ( request.getPom() == null ) && ( request.getBaseDirectory() != null ) )
{
File pom = new File( request.getBaseDirectory(), Maven.POMv4 );
request.setPom( pom );
}
// TODO: Is this correct?
else if ( request.getBaseDirectory() == null )
{
request.setBaseDirectory( new File( System.getProperty( "user.dir" ) ) );
}
}
private void processSettings( MavenExecutionRequest request, Configuration configuration )
throws MavenEmbedderException