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:
Benjamin Bentmann 2009-07-23 21:50:49 +00:00
parent 54c39d9a0f
commit f48d77ce5e
1 changed files with 8 additions and 5 deletions

View File

@ -701,13 +701,15 @@ public class DefaultLifecycleExecutor
if ( artifactMetadataFile.exists() )
{
logger.debug( "Extracting version for plugin " + plugin.getKey() + " from " + artifactMetadataFile );
try
{
Metadata pluginMetadata = readMetadata( artifactMetadataFile );
String release = pluginMetadata.getVersioning().getRelease();
if ( release != null )
if ( StringUtils.isNotEmpty( release ) )
{
plugin.setVersion( release );
}
@ -715,7 +717,7 @@ public class DefaultLifecycleExecutor
{
String latest = pluginMetadata.getVersioning().getLatest();
if ( latest != null )
if ( StringUtils.isNotEmpty( latest ) )
{
plugin.setVersion( latest );
}
@ -726,7 +728,8 @@ public class DefaultLifecycleExecutor
logger.warn( "Error reading plugin metadata: ", e );
}
}
else
if ( StringUtils.isEmpty( plugin.getVersion() ) )
{
throw new PluginNotFoundException( plugin, remoteRepositories );
}