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

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

View File

@ -24,23 +24,25 @@ import org.apache.maven.profiles.ProfileManager;
public interface MavenProjectBuilder
{
// site
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;
// remote-resources-plugin
//TODO remote-resources-plugin
MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
throws ProjectBuildingException;
MavenProject build( File project, ProjectBuilderConfiguration configuration )
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
// would ever need this so it should not be exposed in a public API

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();
@ -526,8 +525,6 @@ public class MavenEmbedder
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 );
@ -114,6 +117,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
{