mirror of
https://github.com/apache/maven.git
synced 2025-02-23 02:15:50 +00:00
Fixing error message coming from a plugin phase-binding that cannot be resolved, or is unspecified.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@559209 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
77567c1123
commit
aaba2df26c
@ -265,6 +265,8 @@ public LifecycleBindings getProjectCustomBindings( final MavenProject project )
|
||||
mojoBinding.setOrigin( "POM" );
|
||||
|
||||
String phase = execution.getPhase();
|
||||
boolean pluginResolved = false;
|
||||
|
||||
if ( phase == null )
|
||||
{
|
||||
if ( pluginDescriptor == null )
|
||||
@ -272,6 +274,7 @@ public LifecycleBindings getProjectCustomBindings( final MavenProject project )
|
||||
try
|
||||
{
|
||||
pluginDescriptor = pluginLoader.loadPlugin( plugin, project );
|
||||
pluginResolved = true;
|
||||
}
|
||||
catch ( PluginLoaderException e )
|
||||
{
|
||||
@ -310,9 +313,42 @@ public LifecycleBindings getProjectCustomBindings( final MavenProject project )
|
||||
|
||||
if ( phase == null )
|
||||
{
|
||||
throw new LifecycleSpecificationException( "No phase specified for goal: "
|
||||
+ goal + " in plugin: " + plugin.getKey() + " from POM: "
|
||||
+ projectId );
|
||||
if ( pluginResolved )
|
||||
{
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
message.append( "\n\nNo lifecycle phase binding can be found for goal: " + goal );
|
||||
message.append( ",\nspecified as a part of the execution: " + execution.getId() );
|
||||
message.append( "in plugin: " );
|
||||
message.append( pluginDescriptor.getPluginLookupKey() );
|
||||
message.append( "\n\nThis plugin was resolved successfully." );
|
||||
message.append( "\nHowever, the mojo metadata it contains does not specify a default lifecycle phase binding." );
|
||||
message.append( "\n\nPlease provide a valid <phase/> specification for execution: " )
|
||||
.append( execution.getId() )
|
||||
.append( " in plugin: " )
|
||||
.append( plugin.getKey() );
|
||||
message.append( "\n\n" );
|
||||
|
||||
throw new LifecycleSpecificationException( message.toString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
message.append( "\n\nNo lifecycle phase binding can be found for goal: " + goal );
|
||||
message.append( ",\nspecified as a part of the execution: " + execution.getId() );
|
||||
message.append( "in plugin: " );
|
||||
message.append( pluginDescriptor.getPluginLookupKey() );
|
||||
message.append( "\n\nThis plugin could not be resolved, so use of the default lifecycle phase binding " )
|
||||
.append( "\n(if there is one) is impossible." );
|
||||
message.append( "\n\nPlease ensure that the plugin: " )
|
||||
.append( plugin.getKey() )
|
||||
.append( " can be resolved by Maven, then try re-running this " )
|
||||
.append( "\nbuild with the -U option, to ensure that all plugin metadata is refreshed." );
|
||||
message.append( "\n\n" );
|
||||
|
||||
throw new LifecycleSpecificationException( message.toString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user