Resolving: MNG-608 (deprecate for now, remove later...notes in TODOs)

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@231084 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-08-09 19:26:24 +00:00
parent ec2da14433
commit 0f9196a83d
2 changed files with 83 additions and 54 deletions

View File

@ -365,7 +365,7 @@ public class DefaultLifecycleExecutor
try
{
// definitely a CLI goal, can use prefix
mojo = getMojoDescriptor( task, session, project, true );
mojo = getMojoDescriptor( task, session, project, task, true );
}
catch ( LifecycleExecutionException e )
{
@ -449,7 +449,7 @@ public class DefaultLifecycleExecutor
throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException
{
// guaranteed to come from the CLI and not be part of a phase
MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session, project, true );
MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session, project, task, true );
executeGoals( Collections.singletonList( new MojoExecution( mojoDescriptor ) ), session, project );
}
@ -570,7 +570,7 @@ public class DefaultLifecycleExecutor
// Not from the CLI, don't use prefix
// TODO: [MNG-608] this needs to be false
MojoDescriptor mojoDescriptor = getMojoDescriptor( goal, session, project, true );
MojoDescriptor mojoDescriptor = getMojoDescriptor( goal, session, project, selectedPhase, false );
addToLifecycleMappings( lifecycleMappings, phase, new MojoExecution( mojoDescriptor ),
session.getSettings() );
}
@ -851,7 +851,7 @@ public class DefaultLifecycleExecutor
}
private MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project,
boolean canUsePrefixes )
String invokedVia, boolean canUsePrefix )
throws ArtifactResolutionException, LifecycleExecutionException
{
String goal;
@ -861,8 +861,15 @@ public class DefaultLifecycleExecutor
StringTokenizer tok = new StringTokenizer( task, ":" );
int numTokens = tok.countTokens();
if ( numTokens == 2 && canUsePrefixes )
// TODO: Add "&& canUsePrefix" to this boolean expression, and remove deprecation warning in next release.
if ( numTokens == 2 )
{
if ( !canUsePrefix )
{
getLogger().warn( "DEPRECATED: Mapped-prefix lookup of mojos are only supported from direct invocation. Please use specification of the form groupId:artifactId[:version]:goal instead. (Offending mojo: \'" + task + "\', invoked via: \'" + invokedVia + "\')" );
}
String prefix = tok.nextToken();
goal = tok.nextToken();
@ -919,13 +926,17 @@ public class DefaultLifecycleExecutor
}
}
}
else if ( numTokens == 4 )
else if ( numTokens == 3 || numTokens == 4 )
{
plugin = new Plugin();
plugin.setGroupId( tok.nextToken() );
plugin.setArtifactId( tok.nextToken() );
plugin.setVersion( tok.nextToken() );
if ( numTokens == 4 )
{
plugin.setVersion( tok.nextToken() );
}
goal = tok.nextToken();
}

View File

@ -162,14 +162,17 @@
<!-- END SNIPPET: lifecycle -->
<!-- START SNIPPET: default-lifecycle -->
<defaultPhases>
<process-resources>resources:resources</process-resources>
<compile>compiler:compile</compile>
<process-test-resources>resources:testResources</process-test-resources>
<test-compile>compiler:testCompile</test-compile>
<test>surefire:test</test>
<package>jar:jar,source:jar</package>
<install>install:install</install>
<deploy>deploy:deploy</deploy>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
<package>
org.apache.maven.plugins:maven-jar-plugin:jar,
org.apache.maven.plugins:maven-source-plugin:jar
</package>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</defaultPhases>
<!-- END SNIPPET: default-lifecycle -->
</configuration>
@ -185,8 +188,8 @@
<configuration>
<!-- START SNIPPET: pom-lifecycle -->
<phases>
<install>install:install</install>
<deploy>deploy:deploy</deploy>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
<!-- END SNIPPET: pom-lifecycle -->
</configuration>
@ -199,14 +202,17 @@
<configuration>
<!-- START SNIPPET: jar-lifecycle -->
<phases>
<process-resources>resources:resources</process-resources>
<compile>compiler:compile</compile>
<process-test-resources>resources:testResources</process-test-resources>
<test-compile>compiler:testCompile</test-compile>
<test>surefire:test</test>
<package>jar:jar,source:jar</package>
<install>install:install</install>
<deploy>deploy:deploy</deploy>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
<package>
org.apache.maven.plugins:maven-jar-plugin:jar,
org.apache.maven.plugins:maven-source-plugin:jar
</package>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
<!-- END SNIPPET: jar-lifecycle -->
</configuration>
@ -219,15 +225,24 @@
<configuration>
<!-- START SNIPPET: maven-plugin-lifecycle -->
<phases>
<generate-resources>plugin:descriptor</generate-resources>
<process-resources>resources:resources</process-resources>
<compile>compiler:compile</compile>
<process-test-resources>resources:testResources</process-test-resources>
<test-compile>compiler:testCompile</test-compile>
<test>surefire:test</test>
<package>jar:jar,plugin:addPluginArtifactMetadata</package>
<install>install:install,plugin:installMapping</install>
<deploy>deploy:deploy,plugin:deployMapping</deploy>
<generate-resources>org.apache.maven.plugins:maven-plugin-plugin:descriptor</generate-resources>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
<package>
org.apache.maven.plugins:maven-jar-plugin:jar,
org.apache.maven.plugins:maven-plugin-plugin:addPluginArtifactMetadata
</package>
<install>
org.apache.maven.plugins:maven-install-plugin:install,
org.apache.maven.plugins:maven-plugin-plugin:installMapping
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:deploy,
org.apache.maven.plugins:maven-plugin-plugin:deployMapping
</deploy>
</phases>
<!-- END SNIPPET: maven-plugin-lifecycle -->
</configuration>
@ -240,14 +255,17 @@
<configuration>
<!-- START SNIPPET: ejb-lifecycle -->
<phases>
<process-resources>resources:resources</process-resources>
<compile>compiler:compile</compile>
<process-test-resources>resources:testResources</process-test-resources>
<test-compile>compiler:testCompile</test-compile>
<test>surefire:test</test>
<package>ejb:ejb,source:jar</package>
<install>install:install</install>
<deploy>deploy:deploy</deploy>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
<package>
org.apache.maven.plugins:maven-ejb-plugin:ejb,
org.apache.maven.plugins:maven-source-plugin:jar
</package>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
<!-- END SNIPPET: ejb-lifecycle -->
</configuration>
@ -260,14 +278,14 @@
<configuration>
<!-- START SNIPPET: war-lifecycle -->
<phases>
<process-resources>resources:resources</process-resources>
<compile>compiler:compile</compile>
<process-test-resources>resources:testResources</process-test-resources>
<test-compile>compiler:testCompile</test-compile>
<test>surefire:test</test>
<package>war:war</package>
<install>install:install</install>
<deploy>deploy:deploy</deploy>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
<package>org.apache.maven.plugins:maven-war-plugin:war</package>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
<!-- END SNIPPET: war-lifecycle -->
</configuration>
@ -280,10 +298,10 @@
<configuration>
<!-- START SNIPPET: ear-lifecycle -->
<phases>
<generate-resources>ear:generate-application-xml</generate-resources>
<package>ear:ear</package>
<install>install:install</install>
<deploy>deploy:deploy</deploy>
<generate-resources>org.apache.maven.plugins:maven-ear-plugin:generate-application-xml</generate-resources>
<package>org.apache.maven.plugins:maven-ear-plugin:ear</package>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
<!-- END SNIPPET: ear-lifecycle -->
</configuration>