From 018a465284736de27f0f183ecb0be4b3ce14bf9a Mon Sep 17 00:00:00 2001 From: Gabriel Ittner Date: Tue, 15 Mar 2022 17:07:07 +0100 Subject: [PATCH 1/2] fix error message when no repo is found --- .../main/kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 5787213e..cbcd9a77 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 @@ -7,7 +7,7 @@ import retrofit2.converter.moshi.MoshiConverterFactory internal class Nexus( baseUrl: String, - username: String, + private val username: String, password: String, private val stagingRepository: String? ) { @@ -38,7 +38,7 @@ internal class Nexus( val allRepositories = getProfileRepositories() ?: emptyList() if (allRepositories.isEmpty()) { - throw IllegalArgumentException("No staging repository prefixed with. Make sure you called \"./gradlew publish\".") + throw IllegalArgumentException("No staging repositories found in account ${username}. Make sure you called \"./gradlew publish\".") } val candidateRepositories = if (stagingRepository != null) { From f793dd3b3ffe442d9d1ea11b4fcfcf4cdf5e02e3 Mon Sep 17 00:00:00 2001 From: Gabriel Ittner Date: Wed, 6 Apr 2022 21:06:14 +0200 Subject: [PATCH 2/2] add username to other error messages --- .../kotlin/com/vanniktech/maven/publish/nexus/Nexus.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 cbcd9a77..cc6524c9 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 @@ -28,7 +28,7 @@ internal class Nexus( val profileRepositoriesResponse = service.getProfileRepositories().execute() if (!profileRepositoriesResponse.isSuccessful) { - throw IOException("Cannot get profileRepositories: ${profileRepositoriesResponse.errorBody()?.string()}") + throw IOException("Cannot get profileRepositories for account $username: ${profileRepositoriesResponse.errorBody()?.string()}") } return profileRepositoriesResponse.body()?.data @@ -38,7 +38,7 @@ internal class Nexus( val allRepositories = getProfileRepositories() ?: emptyList() if (allRepositories.isEmpty()) { - throw IllegalArgumentException("No staging repositories found in account ${username}. Make sure you called \"./gradlew publish\".") + throw IllegalArgumentException("No staging repositories found in account $username. Make sure you called \"./gradlew publish\".") } val candidateRepositories = if (stagingRepository != null) { @@ -49,7 +49,7 @@ internal class Nexus( if (candidateRepositories.isEmpty()) { throw IllegalArgumentException( - "No matching staging repository found. You can can explicitly choose one by " + + "No matching staging repository found in account $username. You can can explicitly choose one by " + "passing it as an option like this \"./gradlew closeAndReleaseRepository --repository=comexample-123\". " + "Available repositories are: ${allRepositories.joinToString(separator = ", ") { it.repositoryId }}" ) @@ -57,7 +57,7 @@ internal class Nexus( if (candidateRepositories.size > 1) { throw IllegalArgumentException( - "More than 1 matching staging repository found. You can can explicitly choose " + + "More than 1 matching staging repository found in account $username. You can can explicitly choose " + "one by passing it as an option like this \"./gradlew closeAndReleaseRepository --repository comexample-123\". " + "Available repositories are: ${allRepositories.joinToString(separator = ", ") { it.repositoryId }}" )