From 1cea9e7faddf4165a5524337b404e7bdb3298d8e Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 29 Jun 2016 01:44:40 -0800 Subject: [PATCH] Better checkVersions. --- .../kotlin/com/beust/kobalt/misc/CheckVersions.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/CheckVersions.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/CheckVersions.kt index 5782afb3..106dfcad 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/CheckVersions.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/CheckVersions.kt @@ -27,9 +27,14 @@ class CheckVersions @Inject constructor(val depManager: DependencyManager, val latestDep = depManager.create(dep.shortId, project.directory) val artifact = (latestDep as AetherDependency).artifact val versions = aether.resolveVersion(artifact) - val highest = versions?.highestVersion?.toString() - if (highest != null && highest != dep.id - && Versions.toLongVersion(highest) > Versions.toLongVersion(dep.version)) { + val releases = versions?.versions?.filter { !it.toString().contains("SNAP")} + val highest = if (releases != null && releases.any()) { + releases.last().toString() + } else { + versions?.highestVersion.toString() + } + if (highest != dep.id + && Versions.toLongVersion(highest) > Versions.toLongVersion(dep.version)) { newVersions.add(artifact.groupId + ":" + artifact.artifactId + ":" + highest) } } catch(e: KobaltException) {