@@ -101,7 +101,7 @@ internal class HttpTransport(
101101 response.close()
102102 return null
103103 }
104- if (! response.isSuccessful) {
104+ if (! response.isSuccessful) {
105105 response.close()
106106 error(" Nmcp: cannot GET '$url ' (statusCode=${response.code} ):\n ${response.body.string()} " )
107107 }
@@ -127,31 +127,24 @@ internal class HttpTransport(
127127 check(response.isSuccessful) {
128128 buildString {
129129 appendLine(" Nmcp: cannot PUT '$url ' (statusCode=${response.code} )." )
130- appendLine(" Response body: ${response.body.string()} " )
130+ appendLine(" Response body: ' ${response.body.string()} ' " )
131131 when (response.code) {
132+ 400 -> {
133+ appendLine(" Things to double check:" )
134+ appendLine(" Your artifacts have proper extensions (.jar, .pom, ...)." )
135+ appendLine(" If publishing a XML file, the XML version is 1.0." )
136+ appendLine(" If publishing a snapshot, the artifacts version is ending with `-SNAPSHOT`." )
137+ }
138+ 401 -> {
139+ appendLine(" Check your credentials" )
140+ appendLine(" If publishing a snapshot, make sure you enabled snapshots on your namespace at https://central.sonatype.com/publishing/namespaces." )
141+ }
142+ 403 -> {
143+ appendLine(" Check that you are publishing to the correct groupId." )
144+ }
132145 429 -> {
133146 appendLine(" Too many requests, try again later" )
134147 }
135- else -> {
136- appendLine(" Things to double check:" )
137- /* *
138- * I have seen 401 for this
139- */
140- appendLine(" - Are your credentials correct?" )
141- appendLine(" - Did you enable the snapshots on your namespace at https://central.sonatype.com/publishing/namespaces?" )
142- /* *
143- * I have seen 400 for this
144- */
145- appendLine(" - Is your version ending with `-SNAPSHOT`?" )
146- /* *
147- * I have seen 400 for this.
148- */
149- appendLine(" - Do your artifacts have proper extensions (.jar, .pom, ...)?" )
150- /* *
151- * I have seen 403 for this.
152- */
153- appendLine(" - Is your groupId correct?" )
154- }
155148 }
156149 }
157150 }
0 commit comments