mthmulders commented on code in PR #757:
URL: https://github.com/apache/maven/pull/757#discussion_r913478933
##########
maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java:
##########
@@ -176,18 +176,31 @@ public MojoDescriptor getMojoDescriptor( String task,
MavenSession session, Mave
}
else if ( numTokens == 3 )
{
- // We have everything that we need except the version
- //
- //
org.apache.maven.plugins:maven-remote-resources-plugin:???:process
- //
- // groupId
- // artifactId
- // ???
- // goal
- //
- plugin = new Plugin();
- plugin.setGroupId( tok.nextToken() );
- plugin.setArtifactId( tok.nextToken() );
+ // groupId:artifactId:goal or pluginPrefix:version:goal (since
Maven 3.9)
+
+ String firstToken = tok.nextToken();
+ // groupId or pluginPrefix? heuristics: groupId contains . but not
pluginPrefix
+ if ( firstToken.contains( "." ) )
Review Comment:
I gave it some thought, but I can't find a better heuristic either. The only
thing more or less foolproof would be to look at the first token, assuming it
is a plugin prefix. If that lookup yields nothing, it would be a groupId.
Even that is not 100% safe, though. Imagine you're not connected to the
network, so lookup fails, so we decide it's a groupId -- this certainly doesn't
make sense. But more importantly, it's probably quite costly compared to a
`String.contains` :-).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]