Wins
Wins

Reputation: 3450

Sbt to publish to both Sonatype and Bintray

I have a scala library that I just converted from gradle to sbt. By default it works by publishing to Sonatype upon release. However I also want to publish it to Bintray. The problem is that Bintray sbt plugin is overwriting the original publish to Sonatype.

I know I can sync to Sonatype and Maven central repository via Bintray. However I still like the way Sonatype handle the validation and check before I really can release it to Maven central.

How do I publish to both Sonatype and Bintray from my release server (not relying on Bintray to sync for me)?

Upvotes: 1

Views: 185

Answers (1)

Justin Kaeser
Justin Kaeser

Reputation: 5948

I ran into the same problem and found a setup that works.

sbt-bintray supports a JVM property flag sbt.sbtbintray, When it is set to false, sbt-bintray will not overwrite the publishTo setting (and a few others). So to publish to both sonatype, just run the sbt publish once with the flag set to true and once to false.

However, I also use the sbt-ci-release plugin, which also overrides the publishTo setting (after bintray), but does not offer a flag to disable this. To workaround this, copy what sbt-bintray does into your own build:

publishTo := {
  val old = publishTo.value
  val p = (publishTo in bintray).value
  if (BintrayPlugin.isEnabledViaProp) p
  else old
}

Also see the build: https://github.com/JetBrains/intellij-compiler-indices/tree/master/sbt-idea-compiler-indices

Upvotes: 0

Related Questions