diff --git a/CHANGELOG.md b/CHANGELOG.md index 6092d56d..40f7dd53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,9 @@ ## 0.23.2 **UNRELEASED** -- Fix signing when using the final Gradle 8.0 release. +- Fix signing when using the final Gradle 8.0 release. +- Finding a matching staging profile in Sonatype is more lenient. If there is just one that one will always be used. + The plugin will also fallback to any staging profile that has a matching prefix with the group id. - As a workaround for an issue in Gradle that causes invalid module metadata for `java-test-fixtures` projects, `project.group` and `project.version` are now being set again for those projects. [#490](https://github.com/vanniktech/gradle-maven-publish-plugin/pull/490) diff --git a/nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt b/nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt index 23c65b0a..73b1acd6 100644 --- a/nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt +++ b/nexus/src/main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt @@ -48,12 +48,18 @@ class Nexus( throw IllegalArgumentException("No staging profiles found in account $username. Make sure you called \"./gradlew publish\".") } - val candidateProfiles = allProfiles.filter { group == it.name || group.startsWith(it.name) } + if (allProfiles.size == 1) { + return allProfiles[0] + } + + val candidateProfiles = allProfiles.filter { group == it.name } + .ifEmpty { allProfiles.filter { group.startsWith(it.name) } } + .ifEmpty { allProfiles.filter { group.commonPrefixWith(it.name).isNotEmpty() } } if (candidateProfiles.isEmpty()) { throw IllegalArgumentException( "No matching staging profile found in account $username. It is expected that the account contains a staging " + - "profile that matches or is the start of $group." + + "profile that matches or is the start of $group. " + "Available profiles are: ${allProfiles.joinToString(separator = ", ") { it.name }}" ) }