o adding a test which shows that a project can be built from the embedder,

now we need to work on the events and logging.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@291775 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2005-09-26 22:49:03 +00:00
parent 16199817d4
commit e7e70cb97f
2 changed files with 20 additions and 5 deletions

View File

@ -278,9 +278,7 @@ public class MavenEmbedder
rm.setFailureBehavior( ReactorManager.FAIL_AT_END );
// The first project is blacklisted?
rm.blackList( (MavenProject) projects.get( 0 ) );
//rm.blackList( (MavenProject) projects.get( 0 ) );
MavenSession session = new MavenSession( embedder.getContainer(),
settings,
@ -290,6 +288,8 @@ public class MavenEmbedder
goals,
executionRootDirectory.getAbsolutePath() );
session.setUsingPOMsFromFilesystem( true );
MavenExecutionResponse response = lifecycleExecutor.execute( session,
rm,
session.getEventDispatcher() );
@ -384,6 +384,8 @@ public class MavenEmbedder
artifactRepositoryFactory = (ArtifactRepositoryFactory) embedder.lookup( ArtifactRepositoryFactory.ROLE );
lifecycleExecutor = (LifecycleExecutor) embedder.lookup( LifecycleExecutor.ROLE );
// ----------------------------------------------------------------------
// If an explicit local repository has not been set then we will use the
// setting builder to use the maven defaults to help us find one.

View File

@ -4,10 +4,13 @@ import junit.framework.TestCase;
import org.apache.maven.model.Model;
import org.apache.maven.project.MavenProject;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.codehaus.plexus.util.FileUtils;
import java.io.File;
import java.util.List;
import java.util.Set;
import java.util.Collections;
public class MavenEmbedderTest
extends TestCase
@ -53,9 +56,19 @@ public class MavenEmbedderTest
public void testPhaseExecution()
throws Exception
{
File pomFile = new File( basedir, "src/test/embedder-test-project/pom.xml" );
File testDirectory = new File( basedir, "src/test/embedder-test-project" );
File targetDirectory = new File( basedir, "target/embedder-test-project" );
FileUtils.copyDirectoryStructure( testDirectory, targetDirectory );
File pomFile = new File( targetDirectory, "pom.xml" );
MavenProject pom = maven.readProjectWithDependencies( pomFile );
EventDispatcher eventDispatcher = new DefaultEventDispatcher();
maven.execute( pom, Collections.singletonList( "package" ), eventDispatcher, targetDirectory );
}
// ----------------------------------------------------------------------