in src/main/java/org/apache/maven/plugins/help/DescribeMojo.java [287:340]
private PluginDescriptor lookupPluginDescriptor(PluginInfo pi) throws MojoExecutionException, MojoFailureException {
Plugin forLookup = null;
if (StringUtils.isNotEmpty(pi.getPrefix())) {
try {
forLookup = mojoDescriptorCreator.findPluginForPrefix(pi.getPrefix(), session);
} catch (NoPluginFoundForPrefixException e) {
throw new MojoExecutionException("Unable to find the plugin with prefix: " + pi.getPrefix(), e);
}
} else if (StringUtils.isNotEmpty(pi.getGroupId()) && StringUtils.isNotEmpty(pi.getArtifactId())) {
forLookup = new Plugin();
forLookup.setGroupId(pi.getGroupId());
forLookup.setArtifactId(pi.getArtifactId());
}
if (forLookup == null) {
String msg = "You must specify either: both 'groupId' and 'artifactId' parameters OR a 'plugin' parameter"
+ " OR a 'cmd' parameter. For instance:" + LS
+ " # mvn help:describe -Dcmd=install" + LS
+ "or" + LS
+ " # mvn help:describe -Dcmd=help:describe" + LS
+ "or" + LS
+ " # mvn help:describe -Dplugin=org.apache.maven.plugins:maven-help-plugin" + LS
+ "or" + LS
+ " # mvn help:describe -DgroupId=org.apache.maven.plugins -DartifactId=maven-help-plugin" + LS
+ LS
+ "Try 'mvn help:help -Ddetail=true' for more information.";
throw new MojoFailureException(msg);
}
if (StringUtils.isNotEmpty(pi.getVersion())) {
forLookup.setVersion(pi.getVersion());
} else {
try {
DefaultPluginVersionRequest versionRequest = new DefaultPluginVersionRequest(forLookup, session);
versionRequest.setPom(project.getModel());
PluginVersionResult versionResult = pluginVersionResolver.resolve(versionRequest);
forLookup.setVersion(versionResult.getVersion());
} catch (PluginVersionResolutionException e) {
throw new MojoExecutionException(
"Unable to resolve the version of the plugin with prefix: " + pi.getPrefix(), e);
}
}
try {
return pluginManager.getPluginDescriptor(
forLookup, project.getRemotePluginRepositories(), session.getRepositorySession());
} catch (Exception e) {
throw new MojoExecutionException(
"Error retrieving plugin descriptor for:" + LS + LS + "groupId: '"
+ groupId + "'" + LS + "artifactId: '" + artifactId + "'" + LS + "version: '" + version
+ "'" + LS
+ LS,
e);
}
}