You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2009/05/25 07:26:27 UTC
svn commit: r778284 - in /maven/components/branches/MNG-2766: ./
maven-core/src/main/java/org/apache/maven/lifecycle/
maven-core/src/test/java/org/apache/maven/lifecycle/
maven-core/src/test/java/org/apache/maven/project/
Author: jvanzyl
Date: Mon May 25 05:26:27 2009
New Revision: 778284
URL: http://svn.apache.org/viewvc?rev=778284&view=rev
Log:
o created an execution plan which currently contains the mojos that will be executed and the phase of dependency resolution required, if needed
Added:
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java (with props)
Modified:
maven/components/branches/MNG-2766/build.xml
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
Modified: maven/components/branches/MNG-2766/build.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/build.xml?rev=778284&r1=778283&r2=778284&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/build.xml (original)
+++ maven/components/branches/MNG-2766/build.xml Mon May 25 05:26:27 2009
@@ -7,7 +7,7 @@
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
@@ -31,210 +31,210 @@
<project default="all" basedir="." xmlns:artifact="urn:maven-artifact-ant">
- <property name="it.workdir.version" value="3.0.x"/>
+<property name="it.workdir.version" value="3.0.x"/>
- <target name="initTaskDefs">
- <xmlproperty file="pom.xml" prefix="pom.xml" />
- <path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1-SNAPSHOT.jar"/>
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath"/>
- </target>
-
- <target name="isMavenHomeSet" depends="initTaskDefs">
- <property environment="env"/>
- <condition property="maven.home" value="${env.M2_HOME}">
- <isset property="env.M2_HOME"/>
- </condition>
- <fail message="You must set the M2_HOME environment variable or specify a maven.home property to this Ant script">
- <condition>
- <or>
- <not>
- <isset property="maven.home" />
- </not>
- <equals arg1="${maven.home}" arg2="" trim="true" />
- </or>
- </condition>
- </fail>
- </target>
-
- <target name="init" depends="isMavenHomeSet">
- <xmlproperty prefix="pom" file="pom.xml"/>
- <dirname file="${maven.home}" property="maven.home.dirname"/>
- <!-- Initialize properties -->
- <property name="maven.home.basename.expected" value="apache-maven-${pom.project.version}"/>
- <property name="maven.home.effective" location="${maven.home.dirname}/${maven.home.basename.expected}"/>
- <property name="maven.assembly" location="apache-maven/target/${maven.home.basename.expected}-bin.zip"/>
- <property name="maven.repo.local" value="${user.home}/.m2/repository"/>
- <property name="maven.debug" value="-e"/>
- <property name="maven.test.skip" value="true"/> <!-- TODO: Change this default back to false once we're done -->
- <property name="surefire.useFile" value="true"/>
- <echo>maven.home = ${maven.home.effective}</echo>
- <echo>maven.repo.local = ${maven.repo.local}</echo>
- </target>
-
- <target name="clean-bootstrap" description="cleans up generated bootstrap classes">
- <delete dir="bootstrap"/>
- </target>
-
- <target name="pull" depends="init" unless="skip.pull">
- <property name="verbose" value="false"/>
- <!-- Pull the dependencies that Maven needs to build -->
- <copy file="pom.xml" tofile="dependencies.xml"/>
- <replace file="${basedir}/dependencies.xml" token="<!--bootstrap-start-comment-->" value="<!--"/>
- <replace file="${basedir}/dependencies.xml" token="<!--bootstrap-end-comment-->" value="-->"/>
- <artifact:pom file="${basedir}/dependencies.xml" id="pom"/>
- <artifact:dependencies pathId="pom.pathid" filesetId="pom.fileset" verbose="${verbose}" useScope="compile">
- <localRepository path="${maven.repo.local}"/>
- <pom refid="pom"/>
- </artifact:dependencies>
- <delete file="${basedir}/dependencies.xml"/>
-
- <!-- Pull the dependencies for Modello -->
- <artifact:dependencies pathId="modello.pathid" filesetId="modello.fileset" verbose="${verbose}">
- <localRepository path="${maven.repo.local}"/>
- <dependency groupId="org.codehaus.modello" artifactId="modello-maven-plugin" version="${pom.properties.modelloVersion}"/>
- </artifact:dependencies>
-
- <!-- Pull the dependencies for the MetadataGenerator CLI -->
- <artifact:dependencies pathId="pmdg.pathid" filesetId="pmdg.fileset" verbose="${verbose}">
- <localRepository path="${maven.repo.local}"/>
- <dependency groupId="org.codehaus.plexus" artifactId="plexus-component-metadata" version="${pom.properties.plexusVersion}"/>
- </artifact:dependencies>
-
- </target>
-
- <target name="process-classes" depends="pull" description="generates plexus component metadata.">
- <mkdir dir="${basedir}/bootstrap/target"/>
- <mkdir dir="${basedir}/bootstrap/target/classes"/>
-
- <path id="maven.classpath">
- <pathelement location="bootstrap/target/classes"/>
- <path refid="sources"/>
- <path refid="pom.pathid"/>
- <path refid="pmdg.pathid"/>
- </path>
-
- <echo>Using plexus version ${pom.properties.plexusVersion}</echo>
- <java fork="fork" classname="org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" failonerror="true">
- <classpath refid="maven.classpath"/>
- <!-- We need to generate component descriptors from the maven-artifact sources which use javadoc annotations. -->
- <arg value="--source"/>
- <arg value="${basedir}/maven-compat/src/main/java"/>
- <!-- We have separated the artifact handlers and lifecycle mappings into a separate file. -->
- <arg value="--descriptors"/>
- <arg value="${basedir}/maven-core/src/main/resources/META-INF/plexus"/>
- <!-- Search the classes for annotations that we've compiled. -->
- <arg value="--classes"/>
- <arg value="${basedir}/bootstrap/target/classes"/>
- <!-- We'll make one big fat components descriptor. -->
- <arg value="--output"/>
- <arg value="${basedir}/bootstrap/target/classes/META-INF/plexus/components.xml"/>
- </java>
- </target>
-
- <target name="generate-sources" depends="pull" description="generates Java sources from Modello mdo model files">
- <mkdir dir="bootstrap/target"/>
- <mkdir dir="bootstrap/target/generated-sources"/>
-
- <macrodef name="modello-single-mode">
- <attribute name="file"/>
- <attribute name="mode"/>
- <attribute name="version"/>
- <sequential>
- <java fork="fork" classname="org.codehaus.modello.ModelloCli" failonerror="true">
- <classpath refid="modello.pathid"/>
- <arg file="@{file}"/> <!-- model file -->
- <arg value="@{mode}"/> <!-- output type -->
- <arg file="bootstrap/target/generated-sources"/> <!-- output directory -->
- <arg value="@{version}"/> <!-- model version -->
- <arg value="false"/> <!-- package with version -->
- <arg value="true"/> <!-- use Java 5 -->
- <arg value="UTF-8"/> <!-- encoding -->
- </java>
- </sequential>
- </macrodef>
-
- <macrodef name="modello">
- <attribute name="file"/>
- <attribute name="version" default="1.0.0"/>
- <sequential>
- <echo taskname="modello" message="Generating sources for @{file}"/>
- <modello-single-mode file="@{file}" version="@{version}" mode="java"/>
- <modello-single-mode file="@{file}" version="@{version}" mode="xpp3-reader"/>
- <modello-single-mode file="@{file}" version="@{version}" mode="xpp3-writer"/>
- </sequential>
- </macrodef>
-
- <modello file="maven-model/src/main/mdo/maven.mdo" version="4.0.0"/>
- <modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo"/>
- <modello file="maven-model-builder/src/main/mdo/profiles.mdo"/>
- <modello file="maven-core/src/main/mdo/settings.mdo"/>
- <modello file="maven-toolchain/src/main/mdo/toolchains.mdo"/>
- <modello file="maven-compat/src/main/mdo/metadata.mdo"/>
- </target>
-
- <target name="compile-boot" depends="generate-sources" description="compiles the bootstrap sources">
- <path id="sources">
- <dirset dir=".">
- <include name="bootstrap/target/generated-sources"/>
- <include name="*/src/main/*"/>
- </dirset>
- </path>
-
- <mkdir dir="bootstrap/target/classes"/>
- <javac destdir="bootstrap/target/classes" encoding="UTF-8" source="1.5" target="1.5" debug="true">
- <src refid="sources"/>
- <classpath refid="pom.pathid"/>
- </javac>
-
- <path id="maven.classpath">
- <pathelement location="bootstrap/target/classes"/>
- <pathelement location="maven-compat/src/main/resources"/>
- <path refid="sources"/>
- <path refid="pom.pathid"/>
- </path>
- </target>
-
- <target name="maven-compile" depends="compile-boot,process-classes" description="compiles Maven using the bootstrap Maven, skipping automated tests">
- <java fork="true" classname="org.apache.maven.cli.MavenCli" failonerror="true">
- <classpath refid="maven.classpath"/>
- <arg value="${maven.debug}"/>
- <arg value="-B"/>
- <arg value="-X"/>
- <arg value="-e"/>
- <arg value="clean"/>
- <arg value="install"/>
- <arg value="-Dmaven.test.skip=${maven.test.skip}"/>
- <arg value="-Dmaven.repo.local=${maven.repo.local}"/>
- <arg value="-Dsurefire.useFile=${surefire.useFile}"/>
- </java>
- </target>
-
- <target name="maven-assembly" depends="maven-compile" description="generates the Maven installation assembly using the bootstrap Maven">
- <echo>
- The new Maven distribution was created as part of the MAVEN-COMPILE step, above.
- This goal just validates the presence of that distribution.
- </echo>
- <condition property="build.failed">
- <not>
- <available file="${maven.assembly}"/>
- </not>
- </condition>
- <fail if="build.failed" message="Assembly task seemed to succeed, but couldn't find assembly file: ${maven.assembly}"/>
- </target>
-
- <target name="extract-assembly" depends="init,maven-assembly" description="extracts the maven assembly into maven.home">
- <echo>Extracting assembly to ${maven.home.dirname} ...</echo>
- <!-- If we are starting from scratch make sure the directory is created -->
- <delete dir="${maven.home.effective}"/>
- <mkdir dir="${maven.home.effective}"/>
- <unzip src="${maven.assembly}" dest="${maven.home.dirname}"/>
- <chmod perm="+x">
- <fileset dir="${maven.home.effective}/bin">
- <include name="mvn"/>
- </fileset>
- </chmod>
- </target>
+<target name="initTaskDefs">
+<xmlproperty file="pom.xml" prefix="pom.xml" />
+<path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1-SNAPSHOT.jar"/>
+<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath"/>
+</target>
+
+<target name="isMavenHomeSet" depends="initTaskDefs">
+<property environment="env"/>
+<condition property="maven.home" value="${env.M2_HOME}">
+<isset property="env.M2_HOME"/>
+</condition>
+<fail message="You must set the M2_HOME environment variable or specify a maven.home property to this Ant script">
+<condition>
+<or>
+<not>
+<isset property="maven.home" />
+</not>
+<equals arg1="${maven.home}" arg2="" trim="true" />
+</or>
+</condition>
+</fail>
+</target>
+
+<target name="init" depends="isMavenHomeSet">
+<xmlproperty prefix="pom" file="pom.xml"/>
+<dirname file="${maven.home}" property="maven.home.dirname"/>
+<!-- Initialize properties -->
+<property name="maven.home.basename.expected" value="apache-maven-${pom.project.version}"/>
+<property name="maven.home.effective" location="${maven.home.dirname}/${maven.home.basename.expected}"/>
+<property name="maven.assembly" location="apache-maven/target/${maven.home.basename.expected}-bin.zip"/>
+<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
+<property name="maven.debug" value="-e"/>
+<property name="maven.test.skip" value="false"/> <!-- TODO: Change this default back to false once we're done -->
+<property name="surefire.useFile" value="true"/>
+<echo>maven.home = ${maven.home.effective}</echo>
+<echo>maven.repo.local = ${maven.repo.local}</echo>
+</target>
+
+<target name="clean-bootstrap" description="cleans up generated bootstrap classes">
+<delete dir="bootstrap"/>
+</target>
+
+<target name="pull" depends="init" unless="skip.pull">
+<property name="verbose" value="false"/>
+<!-- Pull the dependencies that Maven needs to build -->
+<copy file="pom.xml" tofile="dependencies.xml"/>
+<replace file="${basedir}/dependencies.xml" token="<!--bootstrap-start-comment-->" value="<!--"/>
+<replace file="${basedir}/dependencies.xml" token="<!--bootstrap-end-comment-->" value="-->"/>
+<artifact:pom file="${basedir}/dependencies.xml" id="pom"/>
+<artifact:dependencies pathId="pom.pathid" filesetId="pom.fileset" verbose="${verbose}" useScope="compile">
+<localRepository path="${maven.repo.local}"/>
+<pom refid="pom"/>
+</artifact:dependencies>
+<delete file="${basedir}/dependencies.xml"/>
+
+<!-- Pull the dependencies for Modello -->
+<artifact:dependencies pathId="modello.pathid" filesetId="modello.fileset" verbose="${verbose}">
+<localRepository path="${maven.repo.local}"/>
+<dependency groupId="org.codehaus.modello" artifactId="modello-maven-plugin" version="${pom.properties.modelloVersion}"/>
+</artifact:dependencies>
+
+<!-- Pull the dependencies for the MetadataGenerator CLI -->
+<artifact:dependencies pathId="pmdg.pathid" filesetId="pmdg.fileset" verbose="${verbose}">
+<localRepository path="${maven.repo.local}"/>
+<dependency groupId="org.codehaus.plexus" artifactId="plexus-component-metadata" version="${pom.properties.plexusVersion}"/>
+</artifact:dependencies>
+
+</target>
+
+<target name="process-classes" depends="pull" description="generates plexus component metadata.">
+<mkdir dir="${basedir}/bootstrap/target"/>
+<mkdir dir="${basedir}/bootstrap/target/classes"/>
+
+<path id="maven.classpath">
+<pathelement location="bootstrap/target/classes"/>
+<path refid="sources"/>
+<path refid="pom.pathid"/>
+<path refid="pmdg.pathid"/>
+</path>
+
+<echo>Using plexus version ${pom.properties.plexusVersion}</echo>
+<java fork="fork" classname="org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" failonerror="true">
+<classpath refid="maven.classpath"/>
+<!-- We need to generate component descriptors from the maven-artifact sources which use javadoc annotations. -->
+<arg value="--source"/>
+<arg value="${basedir}/maven-compat/src/main/java"/>
+<!-- We have separated the artifact handlers and lifecycle mappings into a separate file. -->
+<arg value="--descriptors"/>
+<arg value="${basedir}/maven-core/src/main/resources/META-INF/plexus"/>
+<!-- Search the classes for annotations that we've compiled. -->
+<arg value="--classes"/>
+<arg value="${basedir}/bootstrap/target/classes"/>
+<!-- We'll make one big fat components descriptor. -->
+<arg value="--output"/>
+<arg value="${basedir}/bootstrap/target/classes/META-INF/plexus/components.xml"/>
+</java>
+</target>
+
+<target name="generate-sources" depends="pull" description="generates Java sources from Modello mdo model files">
+<mkdir dir="bootstrap/target"/>
+<mkdir dir="bootstrap/target/generated-sources"/>
+
+<macrodef name="modello-single-mode">
+<attribute name="file"/>
+<attribute name="mode"/>
+<attribute name="version"/>
+<sequential>
+<java fork="fork" classname="org.codehaus.modello.ModelloCli" failonerror="true">
+<classpath refid="modello.pathid"/>
+<arg file="@{file}"/> <!-- model file -->
+<arg value="@{mode}"/> <!-- output type -->
+<arg file="bootstrap/target/generated-sources"/> <!-- output directory -->
+<arg value="@{version}"/> <!-- model version -->
+<arg value="false"/> <!-- package with version -->
+<arg value="true"/> <!-- use Java 5 -->
+<arg value="UTF-8"/> <!-- encoding -->
+</java>
+</sequential>
+</macrodef>
+
+<macrodef name="modello">
+<attribute name="file"/>
+<attribute name="version" default="1.0.0"/>
+<sequential>
+<echo taskname="modello" message="Generating sources for @{file}"/>
+<modello-single-mode file="@{file}" version="@{version}" mode="java"/>
+<modello-single-mode file="@{file}" version="@{version}" mode="xpp3-reader"/>
+<modello-single-mode file="@{file}" version="@{version}" mode="xpp3-writer"/>
+</sequential>
+</macrodef>
+
+<modello file="maven-model/src/main/mdo/maven.mdo" version="4.0.0"/>
+<modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo"/>
+<modello file="maven-model-builder/src/main/mdo/profiles.mdo"/>
+<modello file="maven-core/src/main/mdo/settings.mdo"/>
+<modello file="maven-toolchain/src/main/mdo/toolchains.mdo"/>
+<modello file="maven-compat/src/main/mdo/metadata.mdo"/>
+</target>
+
+<target name="compile-boot" depends="generate-sources" description="compiles the bootstrap sources">
+<path id="sources">
+<dirset dir=".">
+<include name="bootstrap/target/generated-sources"/>
+<include name="*/src/main/*"/>
+</dirset>
+</path>
+
+<mkdir dir="bootstrap/target/classes"/>
+<javac destdir="bootstrap/target/classes" encoding="UTF-8" source="1.5" target="1.5" debug="true">
+<src refid="sources"/>
+<classpath refid="pom.pathid"/>
+</javac>
+
+<path id="maven.classpath">
+<pathelement location="bootstrap/target/classes"/>
+<pathelement location="maven-compat/src/main/resources"/>
+<path refid="sources"/>
+<path refid="pom.pathid"/>
+</path>
+</target>
+
+<target name="maven-compile" depends="compile-boot,process-classes" description="compiles Maven using the bootstrap Maven, skipping automated tests">
+<java fork="true" classname="org.apache.maven.cli.MavenCli" failonerror="true">
+<classpath refid="maven.classpath"/>
+<arg value="${maven.debug}"/>
+<arg value="-B"/>
+<arg value="-X"/>
+<arg value="-e"/>
+<arg value="clean"/>
+<arg value="install"/>
+<arg value="-Dmaven.test.skip=${maven.test.skip}"/>
+<arg value="-Dmaven.repo.local=${maven.repo.local}"/>
+<arg value="-Dsurefire.useFile=${surefire.useFile}"/>
+</java>
+</target>
+
+<target name="maven-assembly" depends="maven-compile" description="generates the Maven installation assembly using the bootstrap Maven">
+<echo>
+The new Maven distribution was created as part of the MAVEN-COMPILE step, above.
+This goal just validates the presence of that distribution.
+</echo>
+<condition property="build.failed">
+<not>
+<available file="${maven.assembly}"/>
+</not>
+</condition>
+<fail if="build.failed" message="Assembly task seemed to succeed, but couldn't find assembly file: ${maven.assembly}"/>
+</target>
+
+<target name="extract-assembly" depends="init,maven-assembly" description="extracts the maven assembly into maven.home">
+<echo>Extracting assembly to ${maven.home.dirname} ...</echo>
+<!-- If we are starting from scratch make sure the directory is created -->
+<delete dir="${maven.home.effective}"/>
+<mkdir dir="${maven.home.effective}"/>
+<unzip src="${maven.assembly}" dest="${maven.home.dirname}"/>
+<chmod perm="+x">
+<fileset dir="${maven.home.effective}/bin">
+<include name="mvn"/>
+</fileset>
+</chmod>
+</target>
- <target name="all" depends="clean-bootstrap,init,extract-assembly"/>
+<target name="all" depends="clean-bootstrap,init,extract-assembly"/>
</project>
Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=778284&r1=778283&r2=778284&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Mon May 25 05:26:27 2009
@@ -1,4 +1,4 @@
-package org.apache.maven.lifecycle;
+ package org.apache.maven.lifecycle;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
@@ -149,11 +149,11 @@
{
session.setCurrentProject( currentProject );
- List<MojoExecution> lifecyclePlan;
+ MavenExecutionPlan executionPlan;
try
{
- lifecyclePlan = calculateBuildPlan( session, goals.toArray( new String[] {} ) );
+ executionPlan = calculateExecutionPlan( session, goals.toArray( new String[] {} ) );
}
catch ( Exception e )
{
@@ -168,7 +168,7 @@
// mojoDescriptor.isDependencyResolutionRequired() is actually the scope of the dependency resolution required, not a boolean ... yah.
try
{
- downloadProjectDependencies( session, Artifact.SCOPE_TEST /** mojoDescriptor.isDependencyResolutionRequired()*/ );
+ downloadProjectDependencies( session, executionPlan.getRequiredResolutionScope() );
}
catch ( ArtifactNotFoundException e )
{
@@ -185,7 +185,7 @@
{
logger.debug( "=== BUILD PLAN ===" );
logger.debug( "Project: " + currentProject );
- for ( MojoExecution mojoExecution : lifecyclePlan )
+ for ( MojoExecution mojoExecution : executionPlan.getExecutions() )
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
@@ -197,7 +197,7 @@
logger.debug( "==================" );
}
- for ( MojoExecution mojoExecution : lifecyclePlan )
+ for ( MojoExecution mojoExecution : executionPlan.getExecutions() )
{
try
{
@@ -224,7 +224,7 @@
// 3. Find the mojos associated with the lifecycle given the project packaging (jar lifecycle mapping for the default lifecycle)
// 4. Bind those mojos found in the lifecycle mapping for the packaging to the lifecycle
// 5. Bind mojos specified in the project itself to the lifecycle
- public List<MojoExecution> calculateBuildPlan( MavenSession session, String... tasks )
+ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException
{
MavenProject project = session.getCurrentProject();
@@ -233,6 +233,8 @@
List<MojoExecution> lifecyclePlan = new ArrayList<MojoExecution>();
+ String requiredDependencyResolutionScope = null;
+
for ( String task : tasks )
{
@@ -381,7 +383,6 @@
break;
}
}
-
}
}
@@ -397,6 +398,8 @@
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor(
mojoExecution.getGroupId(), mojoExecution.getArtifactId(), mojoExecution.getVersion(), mojoExecution.getGoal(), session.getLocalRepository(), project.getRemoteArtifactRepositories() );
+ requiredDependencyResolutionScope = calculateRequiredDependencyResolutionScope( requiredDependencyResolutionScope, mojoDescriptor.isDependencyResolutionRequired() );
+
mojoExecution.setMojoDescriptor( mojoDescriptor );
populateMojoExecutionConfiguration( project, mojoExecution, false );
@@ -404,9 +407,40 @@
lifecyclePlan.add( mojoExecution );
}
- return lifecyclePlan;
+ return new MavenExecutionPlan( lifecyclePlan, requiredDependencyResolutionScope );
}
+ // SCOPE_COMPILE
+ // SCOPE_TEST
+ // SCOPE_RUNTIME
+ //
+ String calculateRequiredDependencyResolutionScope( String currentRequiredDependencyResolutionScope, String inputScope )
+ {
+ if ( inputScope == null )
+ {
+ return currentRequiredDependencyResolutionScope;
+ }
+
+ if ( currentRequiredDependencyResolutionScope == null && inputScope != null )
+ {
+ return inputScope;
+ }
+
+ if ( currentRequiredDependencyResolutionScope.equals( Artifact.SCOPE_COMPILE ) && ( inputScope.equals( Artifact.SCOPE_RUNTIME ) || inputScope.equals( Artifact.SCOPE_TEST ) ) )
+ {
+ return inputScope;
+ }
+
+ if ( currentRequiredDependencyResolutionScope.equals( Artifact.SCOPE_RUNTIME ) && inputScope.equals( Artifact.SCOPE_TEST ) )
+ {
+ return inputScope;
+ }
+
+ // Nothing changed we return what we were
+ //
+ return currentRequiredDependencyResolutionScope;
+ }
+
private String executionDescription( MojoExecution me, MavenProject project )
{
PluginDescriptor pd = me.getMojoDescriptor().getPluginDescriptor();
@@ -415,25 +449,23 @@
return sb.toString();
}
- private void populateMojoExecutionConfiguration( MavenProject project, MojoExecution mojoExecution,
- boolean directInvocation )
+ private void populateMojoExecutionConfiguration( MavenProject project, MojoExecution mojoExecution, boolean directInvocation )
{
String g = mojoExecution.getGroupId();
String a = mojoExecution.getArtifactId();
- Plugin p = project.getPlugin( g + ":" + a );
+ Plugin plugin = project.getPlugin( g + ":" + a );
- if ( p != null )
+ if ( plugin != null )
{
- for ( PluginExecution e : p.getExecutions() )
+ for ( PluginExecution e : plugin.getExecutions() )
{
if ( mojoExecution.getExecutionId().equals( e.getId() ) )
{
Xpp3Dom executionConfiguration = (Xpp3Dom) e.getConfiguration();
- Xpp3Dom mojoConfiguration =
- extractMojoConfiguration( executionConfiguration, mojoExecution.getMojoDescriptor() );
+ Xpp3Dom mojoConfiguration = extractMojoConfiguration( executionConfiguration, mojoExecution.getMojoDescriptor() );
mojoExecution.setConfiguration( mojoConfiguration );
@@ -446,9 +478,9 @@
{
Xpp3Dom defaultDom = convert( mojoExecution.getMojoDescriptor() );
- if ( p != null && p.getConfiguration() != null )
+ if ( plugin != null && plugin.getConfiguration() != null )
{
- Xpp3Dom projectDom = (Xpp3Dom) p.getConfiguration();
+ Xpp3Dom projectDom = (Xpp3Dom) plugin.getConfiguration();
projectDom = extractMojoConfiguration( projectDom, mojoExecution.getMojoDescriptor() );
mojoExecution.setConfiguration( Xpp3Dom.mergeXpp3Dom( projectDom, defaultDom, Boolean.TRUE ) );
}
@@ -986,7 +1018,7 @@
IOUtil.close( reader );
}
return result;
- }
+ }
// These are checks that should be available in real time to IDEs
Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java?rev=778284&r1=778283&r2=778284&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java (original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java Mon May 25 05:26:27 2009
@@ -28,7 +28,6 @@
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.CycleDetectedInPluginGraphException;
import org.apache.maven.plugin.InvalidPluginDescriptorException;
-import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoNotFoundException;
import org.apache.maven.plugin.PluginDescriptorParsingException;
import org.apache.maven.plugin.PluginNotFoundException;
@@ -50,7 +49,7 @@
* @throws InvalidPluginDescriptorException
* @throws LifecycleExecutionException
*/
- List<MojoExecution> calculateBuildPlan( MavenSession session, String... tasks )
+ MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException;
// For a given project packaging find all the plugins that are bound to any registered
Added: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java?rev=778284&view=auto
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java (added)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java Mon May 25 05:26:27 2009
@@ -0,0 +1,36 @@
+package org.apache.maven.lifecycle;
+
+import java.util.List;
+
+import org.apache.maven.plugin.MojoExecution;
+
+//TODO: lifecycles being executed
+//TODO: what runs in each phase
+//TODO: plugins that need downloading
+//TODO: project dependencies that need downloading
+//TODO: unfortunately the plugins need to be downloaded in order to get the plugin.xml file. need to externalize this from the plugin archive.
+//TODO: this will be the class that people get in IDEs to modify
+public class MavenExecutionPlan
+{
+ /** Individual executions that must be performed. */
+ private List<MojoExecution> executions;
+
+ /** For project dependency resolution, the scope of resolution required if any. */
+ private String requiredDependencyResolutionScope;
+
+ public MavenExecutionPlan( List<MojoExecution> executions, String requiredDependencyResolutionScope )
+ {
+ this.executions = executions;
+ this.requiredDependencyResolutionScope = requiredDependencyResolutionScope;
+ }
+
+ public List<MojoExecution> getExecutions()
+ {
+ return executions;
+ }
+
+ public String getRequiredResolutionScope()
+ {
+ return requiredDependencyResolutionScope;
+ }
+}
Propchange: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java?rev=778284&r1=778283&r2=778284&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java (original)
+++ maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java Mon May 25 05:26:27 2009
@@ -5,10 +5,10 @@
import java.util.List;
import org.apache.maven.AbstractCoreMavenComponentTestCase;
+import org.apache.maven.artifact.Artifact;
import org.apache.maven.exception.ExceptionHandler;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginExecution;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.codehaus.plexus.component.annotations.Requirement;
@@ -63,9 +63,9 @@
MavenSession session = createMavenSession( pom );
assertEquals( "project-with-additional-lifecycle-elements", session.getCurrentProject().getArtifactId() );
assertEquals( "1.0", session.getCurrentProject().getVersion() );
- List<MojoExecution> lifecyclePlan = lifecycleExecutor.calculateBuildPlan( session, "resources:resources" );
- assertEquals( 1, lifecyclePlan.size() );
- MojoExecution mojoExecution = lifecyclePlan.get( 0 );
+ List<MojoExecution> executionPlan = lifecycleExecutor.calculateExecutionPlan( session, "resources:resources" ).getExecutions();
+ assertEquals( 1, executionPlan.size() );
+ MojoExecution mojoExecution = executionPlan.get( 0 );
assertNotNull( mojoExecution );
assertEquals( "org.apache.maven.plugins", mojoExecution.getMojoDescriptor().getPluginDescriptor().getGroupId() );
assertEquals( "maven-resources-plugin", mojoExecution.getMojoDescriptor().getPluginDescriptor().getArtifactId() );
@@ -81,9 +81,9 @@
MavenSession session = createMavenSession( pom );
assertEquals( "project-with-additional-lifecycle-elements", session.getCurrentProject().getArtifactId() );
assertEquals( "1.0", session.getCurrentProject().getVersion() );
- List<MojoExecution> lifecyclePlan = lifecycleExecutor.calculateBuildPlan( session, "clean" );
- assertEquals( 1, lifecyclePlan.size() );
- MojoExecution mojoExecution = lifecyclePlan.get( 0 );
+ List<MojoExecution> executionPlan = lifecycleExecutor.calculateExecutionPlan( session, "clean" ).getExecutions();
+ assertEquals( 1, executionPlan.size() );
+ MojoExecution mojoExecution = executionPlan.get( 0 );
assertNotNull( mojoExecution );
assertEquals( "org.apache.maven.plugins", mojoExecution.getMojoDescriptor().getPluginDescriptor().getGroupId() );
assertEquals( "maven-clean-plugin", mojoExecution.getMojoDescriptor().getPluginDescriptor().getArtifactId() );
@@ -98,7 +98,7 @@
MavenSession session = createMavenSession( pom );
assertEquals( "project-with-additional-lifecycle-elements", session.getCurrentProject().getArtifactId() );
assertEquals( "1.0", session.getCurrentProject().getVersion() );
- List<MojoExecution> lifecyclePlan = lifecycleExecutor.calculateBuildPlan( session, "clean", "install" );
+ List<MojoExecution> executionPlan = lifecycleExecutor.calculateExecutionPlan( session, "clean", "install" ).getExecutions();
//[01] clean:clean
//[02] resources:resources
@@ -111,18 +111,18 @@
//[09] jar:jar
//[10] install:install
//
- assertEquals( 10, lifecyclePlan.size() );
+ assertEquals( 10, executionPlan.size() );
- assertEquals( "clean:clean", lifecyclePlan.get( 0 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "resources:resources", lifecyclePlan.get( 1 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "compiler:compile", lifecyclePlan.get( 2 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "plexus-component-metadata:generate-metadata", lifecyclePlan.get( 3 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "resources:testResources", lifecyclePlan.get( 4 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "compiler:testCompile", lifecyclePlan.get( 5 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "plexus-component-metadata:generate-test-metadata", lifecyclePlan.get( 6 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "surefire:test", lifecyclePlan.get( 7 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "jar:jar", lifecyclePlan.get( 8 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "install:install", lifecyclePlan.get( 9 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "clean:clean", executionPlan.get( 0 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "resources:resources", executionPlan.get( 1 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "compiler:compile", executionPlan.get( 2 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "plexus-component-metadata:generate-metadata", executionPlan.get( 3 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "resources:testResources", executionPlan.get( 4 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "compiler:testCompile", executionPlan.get( 5 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "plexus-component-metadata:generate-test-metadata", executionPlan.get( 6 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "surefire:test", executionPlan.get( 7 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "jar:jar", executionPlan.get( 8 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "install:install", executionPlan.get( 9 ).getMojoDescriptor().getFullGoalName() );
}
// We need to take in multiple lifecycles
@@ -133,7 +133,12 @@
MavenSession session = createMavenSession( pom );
assertEquals( "project-with-multiple-executions", session.getCurrentProject().getArtifactId() );
assertEquals( "1.0.1", session.getCurrentProject().getVersion() );
- List<MojoExecution> lifecyclePlan = lifecycleExecutor.calculateBuildPlan( session, "clean", "install" );
+
+ MavenExecutionPlan plan = lifecycleExecutor.calculateExecutionPlan( session, "clean", "install" );
+
+ assertEquals( Artifact.SCOPE_TEST, plan.getRequiredResolutionScope() );
+
+ List<MojoExecution> executions = plan.getExecutions();
//[01] clean:clean
//[02] modello:xpp3-writer
@@ -153,27 +158,27 @@
//[16] install:install
//
- assertEquals( 16, lifecyclePlan.size() );
+ assertEquals( 16, executions.size() );
- assertEquals( "clean:clean", lifecyclePlan.get( 0 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "modello:xpp3-writer", lifecyclePlan.get( 1 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "modello:java", lifecyclePlan.get( 2 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "modello:xpp3-reader", lifecyclePlan.get( 3 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "modello:xpp3-writer", lifecyclePlan.get( 4 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "modello:java", lifecyclePlan.get( 5 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "modello:xpp3-reader", lifecyclePlan.get( 6 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "plugin:descriptor", lifecyclePlan.get( 7 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "resources:resources", lifecyclePlan.get( 8 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "compiler:compile", lifecyclePlan.get( 9 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "resources:testResources", lifecyclePlan.get( 10 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "compiler:testCompile", lifecyclePlan.get( 11 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "surefire:test", lifecyclePlan.get( 12 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "plugin:addPluginArtifactMetadata", lifecyclePlan.get( 13 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "jar:jar", lifecyclePlan.get( 14 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "install:install", lifecyclePlan.get( 15 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "clean:clean", executions.get( 0 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "modello:xpp3-writer", executions.get( 1 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "modello:java", executions.get( 2 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "modello:xpp3-reader", executions.get( 3 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "modello:xpp3-writer", executions.get( 4 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "modello:java", executions.get( 5 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "modello:xpp3-reader", executions.get( 6 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "plugin:descriptor", executions.get( 7 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "resources:resources", executions.get( 8 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "compiler:compile", executions.get( 9 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "resources:testResources", executions.get( 10 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "compiler:testCompile", executions.get( 11 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "surefire:test", executions.get( 12 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "plugin:addPluginArtifactMetadata", executions.get( 13 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "jar:jar", executions.get( 14 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "install:install", executions.get( 15 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "src/main/mdo/remote-resources.mdo", new MojoExecutionXPathContainer( lifecyclePlan.get( 1 ) ).getValue( "configuration/models[1]/model" ) );
- assertEquals( "src/main/mdo/supplemental-model.mdo", new MojoExecutionXPathContainer( lifecyclePlan.get( 4 ) ).getValue( "configuration/models[1]/model" ) );
+ assertEquals( "src/main/mdo/remote-resources.mdo", new MojoExecutionXPathContainer( executions.get( 1 ) ).getValue( "configuration/models[1]/model" ) );
+ assertEquals( "src/main/mdo/supplemental-model.mdo", new MojoExecutionXPathContainer( executions.get( 4 ) ).getValue( "configuration/models[1]/model" ) );
}
public void testCalculationOfBuildPlanWithIndividualTaskOfTheCleanCleanGoal()
@@ -185,9 +190,9 @@
MavenSession session = createMavenSession( pom );
assertEquals( "project-with-additional-lifecycle-elements", session.getCurrentProject().getArtifactId() );
assertEquals( "1.0", session.getCurrentProject().getVersion() );
- List<MojoExecution> lifecyclePlan = lifecycleExecutor.calculateBuildPlan( session, "clean:clean" );
- assertEquals( 1, lifecyclePlan.size() );
- MojoExecution mojoExecution = lifecyclePlan.get( 0 );
+ List<MojoExecution> executionPlan = lifecycleExecutor.calculateExecutionPlan( session, "clean:clean" ).getExecutions();
+ assertEquals( 1, executionPlan.size() );
+ MojoExecution mojoExecution = executionPlan.get( 0 );
assertNotNull( mojoExecution );
assertEquals( "org.apache.maven.plugins", mojoExecution.getMojoDescriptor().getPluginDescriptor().getGroupId() );
assertEquals( "maven-clean-plugin", mojoExecution.getMojoDescriptor().getPluginDescriptor().getArtifactId() );
@@ -201,7 +206,7 @@
MavenSession session = createMavenSession( pom );
assertEquals( "project-with-additional-lifecycle-elements", session.getCurrentProject().getArtifactId() );
assertEquals( "1.0", session.getCurrentProject().getVersion() );
- List<MojoExecution> lifecyclePlan = lifecycleExecutor.calculateBuildPlan( session, "package" );
+ List<MojoExecution> executionPlan = lifecycleExecutor.calculateExecutionPlan( session, "package" ).getExecutions();
//[01] resources:resources
//[02] compiler:compile
@@ -212,16 +217,16 @@
//[07] surefire:test
//[08] jar:jar
//
- assertEquals( 8, lifecyclePlan.size() );
+ assertEquals( 8, executionPlan.size() );
- assertEquals( "resources:resources", lifecyclePlan.get( 0 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "compiler:compile", lifecyclePlan.get( 1 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "plexus-component-metadata:generate-metadata", lifecyclePlan.get( 2 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "resources:testResources", lifecyclePlan.get( 3 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "compiler:testCompile", lifecyclePlan.get( 4 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "plexus-component-metadata:generate-test-metadata", lifecyclePlan.get( 5 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "surefire:test", lifecyclePlan.get( 6 ).getMojoDescriptor().getFullGoalName() );
- assertEquals( "jar:jar", lifecyclePlan.get( 7 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "resources:resources", executionPlan.get( 0 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "compiler:compile", executionPlan.get( 1 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "plexus-component-metadata:generate-metadata", executionPlan.get( 2 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "resources:testResources", executionPlan.get( 3 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "compiler:testCompile", executionPlan.get( 4 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "plexus-component-metadata:generate-test-metadata", executionPlan.get( 5 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "surefire:test", executionPlan.get( 6 ).getMojoDescriptor().getFullGoalName() );
+ assertEquals( "jar:jar", executionPlan.get( 7 ).getMojoDescriptor().getFullGoalName() );
}
public void testLifecyclePluginsRetrievalForDefaultLifecycle()
@@ -262,4 +267,18 @@
Plugin plugin = lifecycleExecutor.findPluginForPrefix( "clean", session );
assertNotNull( plugin );
}
+
+ //
+
+ public void testRequiredDependencyResolutionScopeCalculation()
+ throws Exception
+ {
+ assertEquals( Artifact.SCOPE_COMPILE, lifecycleExecutor.calculateRequiredDependencyResolutionScope( null, Artifact.SCOPE_COMPILE ) );
+ assertEquals( Artifact.SCOPE_COMPILE, lifecycleExecutor.calculateRequiredDependencyResolutionScope( Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE ) );
+ assertEquals( Artifact.SCOPE_RUNTIME, lifecycleExecutor.calculateRequiredDependencyResolutionScope( null, Artifact.SCOPE_RUNTIME ) );
+ assertEquals( Artifact.SCOPE_RUNTIME, lifecycleExecutor.calculateRequiredDependencyResolutionScope( Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME ) );
+ assertEquals( Artifact.SCOPE_TEST, lifecycleExecutor.calculateRequiredDependencyResolutionScope( null, Artifact.SCOPE_TEST ) );
+ assertEquals( Artifact.SCOPE_TEST, lifecycleExecutor.calculateRequiredDependencyResolutionScope( Artifact.SCOPE_TEST, Artifact.SCOPE_TEST ) );
+ assertEquals( Artifact.SCOPE_RUNTIME, lifecycleExecutor.calculateRequiredDependencyResolutionScope( Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME) );
+ }
}
Modified: maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java?rev=778284&r1=778283&r2=778284&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java (original)
+++ maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java Mon May 25 05:26:27 2009
@@ -28,11 +28,10 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.lifecycle.LifecycleExecutor;
+import org.apache.maven.lifecycle.MavenExecutionPlan;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.CycleDetectedInPluginGraphException;
import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.MojoNotFoundException;
import org.apache.maven.plugin.PluginDescriptorParsingException;
import org.apache.maven.plugin.PluginNotFoundException;
@@ -49,10 +48,10 @@
implements LifecycleExecutor
{
- public List<MojoExecution> calculateBuildPlan( MavenSession session, String... tasks )
+ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException
{
- return Collections.emptyList();
+ return new MavenExecutionPlan( Collections.<MojoExecution>emptyList(), null );
}
public void execute( MavenSession session )