From f48d77ce5e3b1b8b0dfffd869fb16855ca5f07e1 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Thu, 23 Jul 2009 21:50:49 +0000 Subject: [PATCH] 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 --- .../maven/lifecycle/DefaultLifecycleExecutor.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index 5a0cfd17f1..6543ae7b6a 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -700,22 +700,24 @@ 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 ); } else { 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 ); }