From 4468ddfac599ffddc9ac4609bf6226b9e1d5c664 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sat, 14 May 2016 07:43:13 -0700 Subject: [PATCH] [GITHUB-199] Don't display errors if a .jar file can't be resolved. Fixes https://github.com/cbeust/kobalt/issues/199 --- .../main/kotlin/com/beust/kobalt/maven/DependencyManager.kt | 3 +-- .../src/main/kotlin/com/beust/kobalt/maven/aether/Aether.kt | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/DependencyManager.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/DependencyManager.kt index 82d19d2d..c3444162 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/DependencyManager.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/DependencyManager.kt @@ -7,7 +7,6 @@ import com.beust.kobalt.maven.dependency.FileDependency import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.KobaltExecutors import com.beust.kobalt.misc.log -import com.beust.kobalt.misc.warn import com.google.common.collect.ArrayListMultimap import java.io.File import java.util.* @@ -132,7 +131,7 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors, val val nonexistent = reordered.filter{ ! it.jarFile.get().exists() } if (nonexistent.any()) { - warn("Nonexistent dependencies: $nonexistent") + log(2, "[Warning] Nonexistent dependencies: $nonexistent") } val result2 = reordered.filter { diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/Aether.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/Aether.kt index e2434513..86b569bd 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/Aether.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/aether/Aether.kt @@ -141,7 +141,11 @@ class Aether(val localRepo: File, val settings: KobaltSettings) { val result = system.resolveDependencies(session, dependencyRequest).artifactResults return result } catch(ex: DependencyResolutionException) { - warn("Couldn't resolve $artifact") + if (artifact.extension == "pom") { + // Only display a warning for .pom files. Not resolving a .jar or other artifact + // is not necessarily an error as long as there is a pom file. + warn("Couldn't resolve $artifact") + } return emptyList() } }