diff --git a/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/reporter/PlainTextReporter.kt b/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/reporter/PlainTextReporter.kt index a938c804..b52f470b 100644 --- a/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/reporter/PlainTextReporter.kt +++ b/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/reporter/PlainTextReporter.kt @@ -191,7 +191,7 @@ class PlainTextReporter( companion object { /** Returns the dependency key as a stringified label. */ private fun label(dependency: Dependency): String { - return "${dependency.group}:${dependency.name}" + return "${dependency.group.orEmpty()}:${dependency.name}" } } } diff --git a/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/Resolver.kt b/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/Resolver.kt index f661a088..1c36cc42 100644 --- a/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/Resolver.kt +++ b/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/Resolver.kt @@ -69,7 +69,7 @@ class Resolver( val resolvedCoordinate = Coordinate.from(dependency.module.id) val originalCoordinate = coordinates[resolvedCoordinate.key] val coord = originalCoordinate ?: resolvedCoordinate - if (originalCoordinate == null && resolvedCoordinate.groupId != "null") { + if (originalCoordinate == null && resolvedCoordinate.groupId != "none") { project.logger.info("Skipping hidden dependency: $resolvedCoordinate") } else { val projectUrl = getProjectUrl(dependency.module.id) @@ -167,7 +167,7 @@ class Resolver( } // Format the query with an optional classifier and extension - var query = "${dependency.group}:${dependency.name}:$version" + var query = "${dependency.group.orEmpty()}:${dependency.name}:$version" if (dependency.artifacts.isNotEmpty()) { dependency.artifacts.firstOrNull()?.classifier?.let { classifier -> query += ":$classifier" @@ -191,7 +191,7 @@ class Resolver( // If no version was specified then use "none" to pass it through. val version = if (dependency.version == null) "none" else "+" val nonTransitiveDependency = - project.dependencies.create("${dependency.group}:${dependency.name}:$version") as ModuleDependency + project.dependencies.create("${dependency.group.orEmpty()}:${dependency.name}:$version") as ModuleDependency nonTransitiveDependency.isTransitive = false return nonTransitiveDependency } @@ -249,7 +249,7 @@ class Resolver( /** Returns the coordinates for the current (declared) dependency versions. */ private fun getCurrentCoordinates(configuration: Configuration): Map { val declared = getResolvableDependencies(configuration) - .associateBy({ it.key }, { it }) + .associateBy { it.key } if (declared.isEmpty()) { return emptyMap() } @@ -378,7 +378,7 @@ class Resolver( } else { val parent = getParentFromPom(file) if (parent != null && - "${parent.group}:${parent.name}" != "org.sonatype.oss:oss-parent" + "${parent.group.orEmpty()}:${parent.name}" != "org.sonatype.oss:oss-parent" ) { url = getProjectUrl(parent) if (!url.isNullOrEmpty()) { diff --git a/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/resolutionstrategy/ComponentSelectionWithCurrent.kt b/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/resolutionstrategy/ComponentSelectionWithCurrent.kt index 65c719d4..4eb1bef7 100644 --- a/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/resolutionstrategy/ComponentSelectionWithCurrent.kt +++ b/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/resolutionstrategy/ComponentSelectionWithCurrent.kt @@ -10,7 +10,7 @@ class ComponentSelectionWithCurrent( override fun toString(): String { return """\ ComponentSelectionWithCurrent{ - group="${candidate.group}", + group="${candidate.group.orEmpty()}", module="${candidate.module}", version="${candidate.version}", currentVersion="$currentVersion", diff --git a/gradle-versions-plugin/src/test/groovy/com/github/benmanes/gradle/versions/DependencyUpdatesSpec.groovy b/gradle-versions-plugin/src/test/groovy/com/github/benmanes/gradle/versions/DependencyUpdatesSpec.groovy index 0bb69437..12a76ce9 100644 --- a/gradle-versions-plugin/src/test/groovy/com/github/benmanes/gradle/versions/DependencyUpdatesSpec.groovy +++ b/gradle-versions-plugin/src/test/groovy/com/github/benmanes/gradle/versions/DependencyUpdatesSpec.groovy @@ -358,11 +358,11 @@ final class DependencyUpdatesSpec extends Specification { with(reporter) { unresolved.collect { it.selector }.collectEntries { dependency -> [['group': dependency.group, 'name': dependency.name]: dependency.version] - } == [['group': 'null', 'name': 'guava-18.0']: NONE_VERSION] + } == [['group': '', 'name': 'guava-18.0']: NONE_VERSION] upgradeVersions.isEmpty() upToDateVersions.isEmpty() downgradeVersions.isEmpty() - undeclared.contains(new Coordinate('null', 'guice-4.0', NONE_VERSION, null)) + undeclared.contains(new Coordinate('', 'guice-4.0', NONE_VERSION, null)) } }