updating to new apis

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@322531 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2005-10-17 00:43:01 +00:00
parent bf402d7709
commit 5008852983
4 changed files with 93 additions and 84 deletions

View File

@ -2,13 +2,18 @@
<parent>
<artifactId>maven</artifactId>
<groupId>org.apache.maven</groupId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-embedder</artifactId>
<name>Maven Embedder</name>
<version>2.0-beta-4-SNAPSHOT</version>
<version>2.0</version>
<properties>
<mavenVersion>2.0.1-SNAPSHOT</mavenVersion>
</properties>
<build>
<plugins>
<plugin>
@ -32,7 +37,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
@ -49,22 +54,22 @@
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-profile</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
@ -74,17 +79,17 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-repository-metadata</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-registry</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
@ -94,12 +99,12 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@ -109,17 +114,17 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-descriptor</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-monitor</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-manager</artifactId>
<version>2.0-beta-4-SNAPSHOT</version>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>

View File

@ -22,6 +22,7 @@ import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
@ -42,10 +43,10 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.MavenExecutionResponse;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.monitor.event.EventMonitor;
import org.apache.maven.BuildFailureException;
import org.codehaus.classworlds.ClassWorld;
import org.codehaus.classworlds.DuplicateRealmException;
import org.codehaus.plexus.PlexusContainerException;
@ -71,6 +72,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.Collections;
import java.util.Properties;
import java.util.Date;
/**
* Class intended to be used by clients who wish to embed Maven into their applications
@ -286,13 +288,13 @@ public class MavenEmbedder
}
public MavenProject readProjectWithDependencies( File mavenProject, TransferListener transferListener )
throws ProjectBuildingException, ArtifactResolutionException
throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException
{
return mavenProjectBuilder.buildWithDependencies( mavenProject, localRepository, profileManager, transferListener );
}
public MavenProject readProjectWithDependencies( File mavenProject )
throws ProjectBuildingException, ArtifactResolutionException
throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException
{
return mavenProjectBuilder.buildWithDependencies( mavenProject, localRepository, profileManager );
}
@ -378,7 +380,7 @@ public class MavenEmbedder
TransferListener transferListener,
Properties properties,
File executionRootDirectory )
throws CycleDetectedException, LifecycleExecutionException, MojoExecutionException
throws CycleDetectedException, LifecycleExecutionException, BuildFailureException
{
execute( Collections.singletonList( project ), goals, eventMonitor, transferListener, properties, executionRootDirectory );
}
@ -389,7 +391,7 @@ public class MavenEmbedder
TransferListener transferListener,
Properties properties,
File executionRootDirectory )
throws CycleDetectedException, LifecycleExecutionException, MojoExecutionException
throws CycleDetectedException, LifecycleExecutionException, BuildFailureException
{
ReactorManager rm = new ReactorManager( projects );
@ -410,7 +412,8 @@ public class MavenEmbedder
rm,
goals,
executionRootDirectory.getAbsolutePath(),
properties);
properties,
new Date() );
session.setUsingPOMsFromFilesystem( true );
@ -438,14 +441,7 @@ public class MavenEmbedder
}
}
MavenExecutionResponse response = lifecycleExecutor.execute( session,
rm,
session.getEventDispatcher() );
if ( response.isExecutionFailure() )
{
throw new MojoExecutionException( "Project failed to build.", response.getException() );
}
lifecycleExecutor.execute( session, rm, session.getEventDispatcher() );
}
// ----------------------------------------------------------------------
@ -461,7 +457,7 @@ public class MavenEmbedder
PlexusConfiguration configuration = descriptor.getConfiguration();
PlexusConfiguration[] phasesConfigurations = configuration.getChild( "phases" ).getChildren( "phase" );
PlexusConfiguration[] phasesConfigurations = configuration.getChild( "lifecycles" ).getChild( 0 ).getChild( "phases" ).getChildren( "phase" );
try
{
@ -528,15 +524,6 @@ public class MavenEmbedder
runtimeInfo.setPluginUpdateOverride( Boolean.FALSE );
}
if ( checkLatestPluginVersion )
{
runtimeInfo.setCheckLatestPluginVersion( Boolean.TRUE );
}
else
{
runtimeInfo.setCheckLatestPluginVersion( Boolean.FALSE );
}
return runtimeInfo;
}

View File

@ -614,6 +614,7 @@
<implementation>org.apache.maven.usability.InvalidArtifactDiagnoser</implementation>
</component>
<!--
|
| Lifecycle executor
@ -629,50 +630,74 @@
<requirement>
<role>org.apache.maven.extension.ExtensionManager</role>
</requirement>
<!--
<requirement>
<role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
</requirement>
-->
<requirement>
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
</requirement>
</requirements>
<configuration>
<!-- START SNIPPET: lifecyle -->
<phases>
<phase implementation="java.lang.String">validate</phase>
<phase implementation="java.lang.String">initialize</phase>
<phase implementation="java.lang.String">generate-sources</phase>
<phase implementation="java.lang.String">process-sources</phase>
<phase implementation="java.lang.String">generate-resources</phase>
<phase implementation="java.lang.String">process-resources</phase>
<phase implementation="java.lang.String">compile</phase>
<phase implementation="java.lang.String">process-classes</phase>
<phase implementation="java.lang.String">generate-test-sources</phase>
<phase implementation="java.lang.String">process-test-sources</phase>
<phase implementation="java.lang.String">generate-test-resources</phase>
<phase implementation="java.lang.String">process-test-resources</phase>
<phase implementation="java.lang.String">test-compile</phase>
<phase implementation="java.lang.String">test</phase>
<phase implementation="java.lang.String">package</phase>
<phase implementation="java.lang.String">integration-test</phase>
<phase implementation="java.lang.String">verify</phase>
<phase implementation="java.lang.String">install</phase>
<phase implementation="java.lang.String">deploy</phase>
</phases>
<!-- END SNIPPET: lifecycle -->
<lifecycles>
<lifecycle>
<id>default</id>
<!-- START SNIPPET: lifecycle -->
<phases>
<phase>validate</phase>
<phase>initialize</phase>
<phase>generate-sources</phase>
<phase>process-sources</phase>
<phase>generate-resources</phase>
<phase>process-resources</phase>
<phase>compile</phase>
<phase>process-classes</phase>
<phase>generate-test-sources</phase>
<phase>process-test-sources</phase>
<phase>generate-test-resources</phase>
<phase>process-test-resources</phase>
<phase>test-compile</phase>
<phase>test</phase>
<phase>package</phase>
<phase>integration-test</phase>
<phase>verify</phase>
<phase>install</phase>
<phase>deploy</phase>
</phases>
<!-- END SNIPPET: lifecycle -->
</lifecycle>
<lifecycle>
<id>clean</id>
<phases>
<phase>pre-clean</phase>
<phase>clean</phase>
<phase>post-clean</phase>
</phases>
<default-phases>
<clean>org.apache.maven.plugins:maven-clean-plugin:clean</clean>
</default-phases>
</lifecycle>
<lifecycle>
<id>site</id>
<phases>
<phase>pre-site</phase>
<phase>site</phase>
<phase>post-site</phase>
<phase>site-deploy</phase>
</phases>
<default-phases>
<site>org.apache.maven.plugins:maven-site-plugin:site</site>
<site-deploy>org.apache.maven.plugins:maven-site-plugin:deploy</site-deploy>
</default-phases>
</lifecycle>
</lifecycles>
<!-- START SNIPPET: default-reports -->
<defaultReports>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-project-info-reports-plugin</report>
<report>org.apache.maven.plugins:maven-project-info-reports-plugin</report>
<!-- TODO: currently in mojo - should they be defaults any more?
<report implementation="java.lang.String">org.apache.maven.plugins:maven-checkstyle-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-javadoc-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-changelog-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-surefire-report-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-jdepend-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-jxr-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-taglist-plugin</report>
<report>org.apache.maven.plugins:maven-checkstyle-plugin</report>
<report>org.apache.maven.plugins:maven-javadoc-plugin</report>
<report>org.apache.maven.plugins:maven-changelog-plugin</report>
<report>org.apache.maven.plugins:maven-surefire-report-plugin</report>
<report>org.apache.maven.plugins:maven-jdepend-plugin</report>
<report>org.apache.maven.plugins:maven-jxr-plugin</report>
<report>org.apache.maven.plugins:maven-taglist-plugin</report>
-->
</defaultReports>
<!-- END SNIPPET: default-reports -->
@ -855,9 +880,6 @@
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.codehaus.plexus.components.inputhandler.InputHandler</role>
</requirement>
<requirement>
<role>org.apache.maven.project.MavenProjectBuilder</role>
</requirement>
@ -886,7 +908,6 @@
<implementation>org.codehaus.plexus.components.inputhandler.DefaultInputHandler</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
</component>
</components>
</component-set>

View File

@ -113,7 +113,7 @@ public class MavenEmbedderTest
public void testRetrievingLifecyclePhases()
throws Exception
{
List phases = maven.getLifecyclePhases();
List phases = maven.getLifecyclePhases();
assertEquals( "validate", (String) phases.get( 0 ) );
@ -129,8 +129,6 @@ public class MavenEmbedderTest
public void testLocalRepositoryRetrieval()
throws Exception
{
System.out.println( "maven.getLocalRepository() = " + maven.getLocalRepository() );
assertNotNull( maven.getLocalRepository().getBasedir() );
}
@ -163,8 +161,6 @@ public class MavenEmbedderTest
assertEquals( 1, artifacts.size() );
Artifact artifact = (Artifact) artifacts.iterator().next();
System.out.println( "artifact.getFile().getAbsolutePath() = " + artifact.getFile().getAbsolutePath() );
}
// ----------------------------------------------------------------------