Repository: ben-manes/gradle-versions-plugin (kotlin)

Issue:
Only locally available included builds are shown as unresolved
I have build `A` with an included build `build-logic` that is a purely local included build without a published release.
The report show this as
```plain
Failed to determine the latest version for the following dependencies (use --info for details):
 - null:build-logic
The exception that is the cause of unresolved state: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find any matches for null:build-logic:+ as no versions of null:build-logic are available.
Searched in the following locations:
  - https://repo.maven.apache.org/maven2/null/build-logic/maven-metadata.xml
Required by:
    project :
```

If such a dependency that has no version available at all is coming from an included build, then it would be nice if it would not be shown as unresolved, but probably as up-to-date or not at all.

Pull request:
Fixes #725

Patch:
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 a938c8047..b52f470b6 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 f661a0881..e792c676d 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,12 +69,8 @@ class Resolver(
       val resolvedCoordinate = Coordinate.from(dependency.module.id)
       val originalCoordinate = coordinates[resolvedCoordinate.key]
       val coord = originalCoordinate ?: resolvedCoordinate
-      if (originalCoordinate == null && resolvedCoordinate.groupId != "null") {
-        project.logger.info("Skipping hidden dependency: $resolvedCoordinate")
-      } else {
-        val projectUrl = getProjectUrl(dependency.module.id)
-        result.add(DependencyStatus(coord, resolvedCoordinate.version, projectUrl))
-      }
+      val projectUrl = getProjectUrl(dependency.module.id)
+      result.add(DependencyStatus(coord, resolvedCoordinate.version, projectUrl))
     }
 
     for (dependency in unresolved) {
@@ -167,7 +163,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 +187,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 +245,7 @@ class Resolver(
   /** Returns the coordinates for the current (declared) dependency versions. */
   private fun getCurrentCoordinates(configuration: Configuration): Map<Coordinate.Key, Coordinate> {
     val declared = getResolvableDependencies(configuration)
-      .associateBy({ it.key }, { it })
+      .associateBy { it.key }
     if (declared.isEmpty()) {
       return emptyMap()
     }
@@ -378,7 +374,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 65c719d45..4eb1bef79 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",


Test patch:
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 0bb694371..12a76ce9e 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))
     }
   }