mirror of https://github.com/apache/maven.git
o Made plugin version resolution more robust and ensured we fail fast upon resolution failure instead of some NPE in later execution steps
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@797239 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
54c39d9a0f
commit
f48d77ce5e
|
@ -700,22 +700,24 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( artifactMetadataFile.exists() )
|
if ( artifactMetadataFile.exists() )
|
||||||
{
|
{
|
||||||
|
logger.debug( "Extracting version for plugin " + plugin.getKey() + " from " + artifactMetadataFile );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Metadata pluginMetadata = readMetadata( artifactMetadataFile );
|
Metadata pluginMetadata = readMetadata( artifactMetadataFile );
|
||||||
|
|
||||||
String release = pluginMetadata.getVersioning().getRelease();
|
String release = pluginMetadata.getVersioning().getRelease();
|
||||||
|
|
||||||
if ( release != null )
|
if ( StringUtils.isNotEmpty( release ) )
|
||||||
{
|
{
|
||||||
plugin.setVersion( release );
|
plugin.setVersion( release );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String latest = pluginMetadata.getVersioning().getLatest();
|
String latest = pluginMetadata.getVersioning().getLatest();
|
||||||
|
|
||||||
if ( latest != null )
|
if ( StringUtils.isNotEmpty( latest ) )
|
||||||
{
|
{
|
||||||
plugin.setVersion( latest );
|
plugin.setVersion( latest );
|
||||||
}
|
}
|
||||||
|
@ -726,7 +728,8 @@ public class DefaultLifecycleExecutor
|
||||||
logger.warn( "Error reading plugin metadata: ", e );
|
logger.warn( "Error reading plugin metadata: ", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if ( StringUtils.isEmpty( plugin.getVersion() ) )
|
||||||
{
|
{
|
||||||
throw new PluginNotFoundException( plugin, remoteRepositories );
|
throw new PluginNotFoundException( plugin, remoteRepositories );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue