From 350d51ce5c94fd58f2ccd50d2d9e1e0604c4d73a Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Tue, 26 Apr 2005 14:34:47 +0000 Subject: [PATCH] fix error reporting git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@164797 13f79535-47bb-0310-9956-ffa450edef68 --- .../transform/SnapshotTransformation.java | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java b/maven-artifact/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java index 9e95e6ef19..f03d8527cf 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java @@ -141,31 +141,26 @@ public class SnapshotTransformation String version = localMetadata.constructVersion(); - if ( getLogger().isInfoEnabled() && !alreadyResolved ) - { - if ( !version.equals( artifact.getBaseVersion() ) ) - { - String message = artifact.getArtifactId() + ": resolved to version " + version; - if ( artifact.getRepository() != null ) - { - message += " from repository " + artifact.getRepository().getId(); - } - else - { - message += " from local repository"; - } - getLogger().info( message ); - } - else - { - // Locally installed file is newer, don't use the resolved version - getLogger().info( artifact.getArtifactId() + ": using locally installed snapshot" ); - } - } - // TODO: if the POM and JAR are inconsistent, this might mean that different version of each are used if ( !artifact.getFile().exists() || localMetadata.newerThanFile( artifact.getFile() ) ) { + if ( getLogger().isInfoEnabled() && !alreadyResolved ) + { + if ( !version.equals( artifact.getBaseVersion() ) ) + { + String message = artifact.getArtifactId() + ": resolved to version " + version; + if ( artifact.getRepository() != null ) + { + message += " from repository " + artifact.getRepository().getId(); + } + else + { + message += " from local repository"; + } + getLogger().info( message ); + } + } + artifact.setVersion( version ); try { @@ -176,6 +171,14 @@ public class SnapshotTransformation throw new ArtifactMetadataRetrievalException( "Error reading local metadata", e ); } } + else + { + if ( getLogger().isInfoEnabled() && !alreadyResolved ) + { + // Locally installed file is newer, don't use the resolved version + getLogger().info( artifact.getArtifactId() + ": using locally installed snapshot" ); + } + } } }