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

Support bundle upload

xerial opened this issue · comments

Using publishSigned to directly to Sonatype API is quite slow if we need to upload hundreds of artifacts.

Instead, it seems we can use the bundle upload PUT API of sonatype (Discussed in #83)

A possible approach:

Related:

This is also related (and most likely reusable): https://github.com/sonatype/spice-zapper

This thing is under the hood of the ant library and it can pack artifacts into several bundles and upload them concurrently. I would strongly recommend to reuse it.

Right. It seems using zapper is quite easy.

I'm now thinking how to set publishTo target for publishSignedLocal to target/staging folder

That's what I do for my projects (unfortunately, stating works for releases only, I may be wrong but I didn't find a way to publish snapshots this way):

    publishTo := (if (!isSnapshot.value) {
        Some(Resolver.file("local-publish", new File("target/local-repo")))
      } else {
        Some(Opts.resolver.sonatypeSnapshots)
      })

I guess you may just add similar thing into projectSettings.

Actually I think it may be a good idea to hook straight into publish task ( an example may be found in https://github.com/laughedelic/sbt-publish-more/blob/master/src/main/scala/PublishMore.scala ), though yes - even dirty approach with publish*Local would be a great relief for everyone.

No worries. It's possible to dynamically configure publishTo by using sbt command (as sonatypePrepare already doing that).

I'm now testing how bundle upload works

Good news. Uploading 1000s of files using a bundle finished within a minute!

Just as planned. You are welcome :3

Released sbt-sonatype 3.1 with bundle upload support. Many thanks @pshirshov

Updated https://github.com/softwaremill/sbt-softwaremill with the latest sbt-sonatype. So far bundle-publishing of the plugin itself went great. This will really make working with OSS much easier :) Thanks!

@xerial : I guess you should put a snippet like this into the doc:

First enable bundle publishing for you release configuration:

publishTo in ThisBuild := (if (!isSnapshot.value) {
  sonatypePublishToBundle.value
} else {
  Some(Opts.resolver.sonatypeSnapshots)
})

Then use sonatypeBundleRelease:

sbt +clean sonatypeBundleClean +publishSigned sonatypeBundleRelease

@pshirshov sonatypePublishToBundle is almost the same as what you mentioned.

I think this is a little bit an off-topic for this thread. We should use a different ticket if necessary.

@pshirshov what worked for me is sonatypeBundleRelease + the publishTo setting, see https://github.com/softwaremill/sbt-softwaremill/blob/master/src/main/scala/com/softwaremill/Publish.scala#L29 lines 29 and 85