diff options
author | Andrew Richards <richards.aj@gmail.com> | 2018-02-19 21:47:31 +0000 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-19 13:47:31 -0800 |
commit | ac99d84530c02078c62e743750084cf2972caed2 (patch) | |
tree | 8254751870329517d5a726ae2700c0b65821a851 | |
parent | 87daeda7c3f31d9b7ac881fc0feafedeec653f59 (diff) | |
download | mill-ac99d84530c02078c62e743750084cf2972caed2.tar.gz mill-ac99d84530c02078c62e743750084cf2972caed2.tar.bz2 mill-ac99d84530c02078c62e743750084cf2972caed2.zip |
Better error messages when publishing to Sonatype (#138)
-rw-r--r-- | docs/pages/1 - Intro to Mill.md | 2 | ||||
-rw-r--r-- | scalalib/src/mill/scalalib/publish/SonatypeHttpApi.scala | 3 | ||||
-rw-r--r-- | scalalib/src/mill/scalalib/publish/SonatypePublisher.scala | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md index 27c58740..24f11011 100644 --- a/docs/pages/1 - Intro to Mill.md +++ b/docs/pages/1 - Intro to Mill.md @@ -513,7 +513,7 @@ Missing arguments: (--sonatypeCreds: String, --gpgPassphrase: String, --release: Arguments provided did not match expected signature: publish - --sonatypeCreds String + --sonatypeCreds String (format: "username:password") --gpgPassphrase String --release Boolean ``` diff --git a/scalalib/src/mill/scalalib/publish/SonatypeHttpApi.scala b/scalalib/src/mill/scalalib/publish/SonatypeHttpApi.scala index ca78f893..0b5785a5 100644 --- a/scalalib/src/mill/scalalib/publish/SonatypeHttpApi.scala +++ b/scalalib/src/mill/scalalib/publish/SonatypeHttpApi.scala @@ -30,6 +30,7 @@ class SonatypeHttpApi(uri: String, credentials: String) { def getStagingProfileUri(groupId: String): String = { val response = withRetry( PatientHttp(s"$uri/staging/profiles").headers(commonHeaders)) + .throwError val resourceUri = json @@ -49,6 +50,7 @@ class SonatypeHttpApi(uri: String, credentials: String) { .option(HttpOptions.readTimeout(60000)) .headers(commonHeaders) .asString + .throwError json.read(response.body)("type").str.toString } @@ -59,6 +61,7 @@ class SonatypeHttpApi(uri: String, credentials: String) { .headers(commonHeaders) .postData( s"""{"data": {"description": "fresh staging profile for ${groupId}"}}""")) + .throwError json.read(response.body)("data")("stagedRepositoryId").str.toString } diff --git a/scalalib/src/mill/scalalib/publish/SonatypePublisher.scala b/scalalib/src/mill/scalalib/publish/SonatypePublisher.scala index 4d03e182..ad0373c1 100644 --- a/scalalib/src/mill/scalalib/publish/SonatypePublisher.scala +++ b/scalalib/src/mill/scalalib/publish/SonatypePublisher.scala @@ -106,7 +106,7 @@ class SonatypePublisher(uri: String, private def reportPublishResults(publishResults: Seq[HttpResponse[String]], artifacts: Seq[Artifact]) = { if (publishResults.forall(_.is2xx)) { - log.info(s"Published v${artifacts.map(_.id).mkString(", ")} to Sonatype") + log.info(s"Published ${artifacts.map(_.id).mkString(", ")} to Sonatype") } else { val errors = publishResults.filterNot(_.is2xx).map { response => s"Code: ${response.code}, message: ${response.body}" |