xerial / sbt-sonatype

A sbt plugin for publishing Scala/Java projects to the Maven central.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sonatypePublishToBundle not found

vvasuki opened this issue · comments

If I put publishTo := sonatypePublishToBundle.value in my build file ( link ), I get

/home/vvasuki/gitland/indic-transliteration/indic_transliteration_scala/build.sbt:38: error: not found: value sonatypePublishToBundle
publishTo := sonatypePublishToBundle.value
             ^
[error] Type error in expression

What am I doing wrong?

  • sbt version: 1.7.3
  • sbt-sonatype version: 2.0
[IJ]sonatypeProfileName
[info] indic-transliteration
[IJ]sonatypeRepository
[info] https://oss.sonatype.org/service/local
[IJ]

Also, in ~/.sbt/1.0/sonatype.sbt , I have:

sonatypeProfileName := "com.github.sanskrit-coders" . Whence do I get indic-transliteration above?

The latest version of sbt-sonatype is 3.9.14. Try the latest one first

Thanks! I got past that problem, but now getting different errors. Trying with a simpler repository (https://github.com/sanskrit-coders/scala-utils/blob/d582dedfa08ce117d0bf3a9df788a7938b3a0da1/build.sbt ):

[IJ]sonatypeProfileName
[info] com.github.sanskrit-coders
[IJ]sonatypeRepository
[info] https://oss.sonatype.org/service/local
[IJ]

[IJ]publishSigned
[info] Wrote /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/scala-2.13/scala-utils_2.13-1.24-SNAPSHOT.pom
[warn] versionScheme setting is empty; set `ThisBuild / versionScheme := Some("early-semver")`, `Some("semver-spec")` or `Some("pvp")`
[warn] so tooling can use it for eviction errors etc - https://www.scala-sbt.org/1.x/docs/Publishing.html
[error] gpg: WARNING: unsafe permissions on homedir '/home/vvasuki/.gnupg'
[error] stack trace is suppressed; run last publishSigned for the full output
[error] (publishSigned) java.io.IOException: Server returned HTTP response code: 403 for URL: https://oss.sonatype.org/content/repositories/snapshots/default/scala-utils_2.13/1.24-SNAPSHOT/scala-utils_2.13-1.24-SNAPSHOT-sources.jar.asc
[error] Total time: 3 s, completed Nov 5, 2022, 7:34:08 AM
[IJ]

And running the release command fails with 2022-11-05 07:36:19.868+0530 warn [SonatypeService] No staging repository is found. Do publishSigned first. - (SonatypeService.scala:119).

For a fresh start I'd dropped the staging repo I found via the web interface:

image

How to get past this?

It's a permission error. See https://github.com/xerial/sbt-sonatype#homesbtsbt-version-013-or-10sonatypesbt

I doubt it because I have -

> cat ~/.sbt/1.0/sonatype.sbt                                                                                                                                  ✔ 

credentials += Credentials("Sonatype Nexus Repository Manager",
  "oss.sonatype.org",
  "vishvas",
  "REMOVED")

// Your profile name of the sonatype account. The default is the same with the organization value
sonatypeProfileName := "com.github.sanskrit-coders"

// To sync with Maven central, you need to supply the following information:
publishMavenStyle := true

// License of your choice
licenses := Seq("APL2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
homepage := Some(url("https://sanskrit-coders.github.io/"))

developers := List(
  Developer(
    id    = "sanskrit-coders",
    name  = "Sanskrit Coders",
    email = "sanskrit-programmers@googlegroups.com",
    url   = url("https://sanskrit-coders.github.io/")
  )
)%                                                           

(I've added some common settings there instead of (project root)/sonatype.sbt since multiple projects share the same developers, licenses, homepage etc. fields.

And also, your sbt-release configuration is out-dated. See https://github.com/xerial/sbt-sonatype#using-with-sbt-release-plugin

The below seems right as per the link?

releaseProcess := Seq[ReleaseStep](
  checkSnapshotDependencies,
  inquireVersions,
  runClean,
  runTest,
  setReleaseVersion,
  commitReleaseVersion,
  tagRelease,
  releaseStepCommand("publishSigned"),
  releaseStepCommand("sonatypeRelease"),
  setNextVersion,
  commitNextVersion,
  pushChanges
)

The "read staging respository" step seems to succeed - Yet, I get the error:

[info] 	publish commited: moved /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25/default/scala-utils_2.13/1.25.part 
[info] 		to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25/default/scala-utils_2.13/1.25
[success] Total time: 2 s, completed Nov 5, 2022, 1:08:33 PM
2022-11-05 13:08:33.871+0530  info [SonatypeService] sonatypeRepository  : https://oss.sonatype.org/service/local  - (SonatypeService.scala:26)
2022-11-05 13:08:33.873+0530  info [SonatypeService] sonatypeProfileName : com.github.sanskrit-coders  - (SonatypeService.scala:27)
2022-11-05 13:08:33.874+0530  info [SonatypeClient] Reading staging repository profiles...  - (SonatypeClient.scala:100)
2022-11-05 13:08:47.276+0530  warn [SonatypeService] No staging repository is found. Do publishSigned first.  - (SonatypeService.scala:119)
2022-11-05 13:08:47.293+0530  info [SonatypeClient] Reading staging profiles...  - (SonatypeClient.scala:114)
2022-11-05 13:08:49.690+0530 error [Sonatype] 
java.lang.IllegalStateException: No staging repository is found. Run publishSigned first

The releasing step has been changed a long time ago. publishSigned no longer creates staging repository at Sonatype. https://medium.com/@taroleo/sbt-sonatype-f02bdafd78f1

// This setting creates a bundle in the local directory if version is not a snapshot:
publishTo := sonatypePublishToBundle.value

sonatypeRelease has been changed to sonatypeBundleRelease:

  releaseStepCommand("publishSigned"), // This creates files in local repository 
  releaseStepCommand("sonatypeBundleRelease"), // This step uploads bundle and perform releasing steps at sonatype

sonatypeRelease has been changed to sonatypeBundleRelease:

Thank you! Upon fixing the above, I don't get the previous mentioned error. But now I get:


2022-11-08 14:27:40.442+0530  info [SonatypeClient]   Evaluate: profile-target-matching-staging  - (SonatypeClient.scala:384)
2022-11-08 14:27:40.442+0530  info [SonatypeClient] The close stage is in progress. Waiting for 10.13 sec.  - (SonatypeClient.scala:164)
2022-11-08 14:27:51.255+0530  info [SonatypeClient]     Failed: profile-target-matching-staging, failureMessage:Profile target mismatch: /default/scala-utils_2.13/1.25/scala-utils_2.13-1.25-sources.jar.asc  - (SonatypeClient.scala:384)
2022-11-08 14:27:51.255+0530  info [SonatypeClient]   Evaluate: signature-staging  - (SonatypeClient.scala:384)
2022-11-08 14:27:51.255+0530  info [SonatypeClient]     Passed: signature-staging  - (SonatypeClient.scala:384)
2022-11-08 14:27:51.256+0530  info [SonatypeClient]   Evaluate: no-traversal-paths-in-archive-file  - (SonatypeClient.scala:384)
2022-11-08 14:27:51.256+0530 error [SonatypeClient] [close] Failed  - (SonatypeClient.scala:176)
2022-11-08 14:27:51.256+0530 error [SonatypeClient] Activity name:close, started:2022-11-08T08:57:24.943Z  - (SonatypeClient.scala:464)
2022-11-08 14:27:51.257+0530 error [SonatypeClient]     Failed: profile-target-matching-staging, failureMessage:Profile target mismatch: /default/scala-utils_2.13/1.25/scala-utils_2.13-1.25-sources.jar.asc  - (SonatypeClient.scala:382)
2022-11-08 14:27:51.258+0530 error [Sonatype] [STAGE_FAILURE] Failed to close the repository.  - (Sonatype.scala:440)

Process finished with exit code 1

Build file is https://github.com/sanskrit-coders/scala-utils/blob/master/build.sbt . What else is wrong?

It seems this error is shown if your uploaded artifact is not following Maven's conversion:

2022-11-08 14:27:51.255+0530  info [SonatypeClient]     Failed: profile-target-matching-staging, failureMessage:Profile target mismatch: /default/scala-utils_2.13/1.25/scala-utils_2.13-1.25-sources.jar.asc  - (SonatypeClient.scala:384)

The path includes /default, which should be removed somehow.

The path includes /default, which should be removed somehow.

I see, thanks! No idea where that is coming from - tried searching for "default" in the codebase - but turned up nothing.
Earlier messages look like this:

[info] Main Scala API documentation successful.
[info] 	published scala-utils_2.13 to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0.part/scala-utils_2.13-1.25.0-sources.jar.asc
[info] 	published scala-utils_2.13 to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0.part/scala-utils_2.13-1.25.0.jar
[info] 	published scala-utils_2.13 to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0.part/scala-utils_2.13-1.25.0.pom
[info] 	published scala-utils_2.13 to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0.part/scala-utils_2.13-1.25.0.jar.asc
[info] 	published scala-utils_2.13 to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0.part/scala-utils_2.13-1.25.0-javadoc.jar.asc
[info] 	published scala-utils_2.13 to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0.part/scala-utils_2.13-1.25.0.pom.asc
[info] 	published scala-utils_2.13 to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0.part/scala-utils_2.13-1.25.0-javadoc.jar
[info] 	published scala-utils_2.13 to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0.part/scala-utils_2.13-1.25.0-sources.jar
[info] 	publish commited: moved /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0.part 
[info] 		to /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0/default/scala-utils_2.13/1.25.0
[success] Total time: 2 s, completed Nov 10, 2022, 5:27:30 PM
2022-11-10 17:27:30.122+0530  info [SonatypeService] sonatypeRepository  : https://oss.sonatype.org/service/local  - (SonatypeService.scala:26)
2022-11-10 17:27:30.125+0530  info [SonatypeService] sonatypeProfileName : com.github.sanskrit-coders  - (SonatypeService.scala:27)
2022-11-10 17:27:30.128+0530  info [SonatypeClient] Reading staging repository profiles...  - (SonatypeClient.scala:100)
[info] Preparing a new staging repository for [sbt-sonatype] scala-utils 1.25.0
2022-11-10 17:27:31.163+0530  info [SonatypeClient] Reading staging profiles...  - (SonatypeClient.scala:114)
2022-11-10 17:27:34.760+0530  info [SonatypeClient] Creating a staging repository in profile com.github.sanskrit-coders with a description key: [sbt-sonatype] scala-utils 1.25.0  - (SonatypeClient.scala:120)
2022-11-10 17:27:35.052+0530  info [SonatypeService] No previous staging repository for [sbt-sonatype] scala-utils 1.25.0 was found  - (SonatypeService.scala:99)
2022-11-10 17:27:42.551+0530  info [SonatypeClient] Created successfully: comgithubsanskrit-coders-1168  - (SonatypeClient.scala:133)
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J: Ignoring binding found at [jar:file:/home/vvasuki/.sbt/boot/scala-2.12.17/org.scala-sbt/sbt/1.7.3/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
2022-11-10 17:27:42.613+0530  info [SonatypeClient] Uploading bundle /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0 to https://oss.sonatype.org/service/local/staging/deployByRepositoryId/comgithubsanskrit-coders-1168/  - (SonatypeClient.scala:294)
2022-11-10 17:27:44.986+0530  info [SonatypeClient] Finished bundle upload: /home/vvasuki/gitland/sanskrit-coders/scala-utils/target/sonatype-staging/1.25.0  - (SonatypeClient.scala:296)
2022-11-10 17:27:44.989+0530  info [SonatypeClient] Closing staging repository [comgithubsanskrit-coders-1168] status:open, profile:com.github.sanskrit-coders(55338d12f081b8) description: [sbt-sonatype] scala-utils 1.25.0  - (SonatypeClient.scala:192)
2022-11-10 17:27:45.662+0530  info [SonatypeClient] Activity name:open, started:2022-11-10T11:57:37.541Z, stopped:2022-11-10T11:57:42.514Z  - (SonatypeClient.scala:395)
2022-11-10 17:27:45.663+0530  info [SonatypeClient] repositoryCreated: id:comgithubsanskrit-coders-1168, user:vishvas, ip:45.127.46.150  - (SonatypeClient.scala:384)
2022-11-10 17:27:45.666+0530  info [SonatypeClient] The close stage is in progress. Waiting for 3.00 sec.  - (SonatypeClient.scala:164)
2022-11-10 17:27:48.911+0530  info [SonatypeClient] Activity name:close, started:2022-11-10T11:57:46.819Z  - (SonatypeClient.scala:395)
2022-11-10 17:27:48.911+0530  info [SonatypeClient]   Evaluate: id:8df11eec44baf2, rule:sources-staging, rule.disabled:javadoc-staging  - (SonatypeClient.scala:384)
2022-11-10 17:27:48.911+0530  info [SonatypeClient] The close stage is in progress. Waiting for 4.50 sec.  - (SonatypeClient.scala:164)
2022-11-10 17:27:53.645+0530  info [SonatypeClient]   Evaluate: checksum-staging  - (SonatypeClient.scala:384)
2022-11-10 17:27:53.645+0530  info [SonatypeClient]     Passed: checksum-staging  - (SonatypeClient.scala:384)
2022-11-10 17:27:53.645+0530  info [SonatypeClient]   Evaluate: signature-staging  - (SonatypeClient.scala:384)
2022-11-10 17:27:53.645+0530  info [SonatypeClient]     Passed: signature-staging  - (SonatypeClient.scala:384)
2022-11-10 17:27:53.646+0530  info [SonatypeClient]   Evaluate: pom-staging  - (SonatypeClient.scala:384)
2022-11-10 17:27:53.646+0530  info [SonatypeClient] The close stage is in progress. Waiting for 6.75 sec.  - (SonatypeClient.scala:164)
2022-11-10 17:28:01.308+0530  info [SonatypeClient]     Passed: pom-staging  - (SonatypeClient.scala:384)
2022-11-10 17:28:01.308+0530  info [SonatypeClient]   Evaluate: sources-staging  - (SonatypeClient.scala:384)
2022-11-10 17:28:01.309+0530  info [SonatypeClient]     Passed: sources-staging  - (SonatypeClient.scala:384)
2022-11-10 17:28:01.309+0530  info [SonatypeClient]   Evaluate: profile-target-matching-staging  - (SonatypeClient.scala:384)
2022-11-10 17:28:01.309+0530  info [SonatypeClient]     Failed: profile-target-matching-staging, failureMessage:Profile target mismatch: /default/scala-utils_2.13/1.25.0/scala-utils_2.13-1.25.0-javadoc.jar.sha1  - (SonatypeClient.scala:384)
2022-11-10 17:28:01.309+0530  info [SonatypeClient]   Evaluate: no-traversal-paths-in-archive-file  - (SonatypeClient.scala:384)
2022-11-10 17:28:01.309+0530 error [SonatypeClient] [close] Failed  - (SonatypeClient.scala:176)
2022-11-10 17:28:01.309+0530 error [SonatypeClient] Activity name:close, started:2022-11-10T11:57:46.819Z  - (SonatypeClient.scala:464)
2022-11-10 17:28:01.310+0530 error [SonatypeClient]     Failed: profile-target-matching-staging, failureMessage:Profile target mismatch: /default/scala-utils_2.13/1.25.0/scala-utils_2.13-1.25.0-javadoc.jar.sha1  - (SonatypeClient.scala:382)
2022-11-10 17:28:01.311+0530 error [Sonatype] [STAGE_FAILURE] Failed to close the repository.  - (Sonatype.scala:440)

Process finished with exit code 1

Got a solution there!

Earlier I had (as required in https://github.com/xerial/sbt-sonatype ):

sonatypeProfileName := "com.github.sanskrit-coders"

I was able to release, as soon as I added:

organization := "com.github.sanskrit-coders"
organizationName := "com.github.sanskrit-coders"
organizationHomepage := Some(url("https://sanskrit-coders.github.io/"))

Is this a bug in README.md?

ALso, in case organization is not set, rather than using default which would leave debuggers clueless, it may be a good idea to set unspecifiedOrganization etc..

Glad to hear that your problem was fixed. I didn't know the default organization value is set to default in sbt.

organizationName/homePage information is necessary for properly setting <developer> tag in pom.xml. See also the central requirements: https://central.sonatype.org/publish/requirements/#developer-information

In sbt-sonatype, these values can be set implicitly if you use

sonatypeProjectHosting := Some(GitHubHosting("username", "projectName", "user@example.com"))

or manually add developer settings.

Actually, it's already documented here:
https://github.com/xerial/sbt-sonatype#project-rootsonatypesbt

Let me close this issue as the original problem was resolved.