All Projects → laughedelic → sbt-publish-more

laughedelic / sbt-publish-more

Licence: LGPL-3.0 License
📤 Publish artifacts to more than one repository

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to sbt-publish-more

sbt-travisci
An sbt plugin to integrate with Travis CI
Stars: ✭ 44 (+109.52%)
Mutual labels:  sbt, sbt-plugin
sbt-hepek
Sbt plugin for rendering Scala objects to files. And more!
Stars: ✭ 17 (-19.05%)
Mutual labels:  sbt, sbt-plugin
sbt-project-switcher
A sbt plugin to switch project in a snappy way⚡️
Stars: ✭ 36 (+71.43%)
Mutual labels:  sbt, sbt-plugin
sbt-ammonite-classpath
Export the classpath for Ammonite and Almond
Stars: ✭ 29 (+38.1%)
Mutual labels:  sbt, sbt-plugin
sbt-example
Run Scaladoc as unit tests
Stars: ✭ 30 (+42.86%)
Mutual labels:  sbt, sbt-plugin
sbt-swagger-2
sbt plugin for generating Swagger JSON schemas during build
Stars: ✭ 13 (-38.1%)
Mutual labels:  sbt, sbt-plugin
xsbt-webstart
A Webstart plugin for sbt
Stars: ✭ 12 (-42.86%)
Mutual labels:  sbt, sbt-plugin
sbt-sass
A fork of the sbt-sass repository which seems to be abandoned.
Stars: ✭ 32 (+52.38%)
Mutual labels:  sbt, sbt-plugin
sbt-jni
SBT Plugin to ease working with JNI
Stars: ✭ 110 (+423.81%)
Mutual labels:  sbt, sbt-plugin
sbt-flaky
Detect flaky tests with sbt
Stars: ✭ 35 (+66.67%)
Mutual labels:  sbt, sbt-plugin
gatling-sbt-plugin
Gatling Plugin for SBT
Stars: ✭ 105 (+400%)
Mutual labels:  sbt, sbt-plugin
sbt-ecr
An SBT plugin for managing Docker images within Amazon ECR.
Stars: ✭ 52 (+147.62%)
Mutual labels:  sbt, sbt-plugin
sbt-findbugs
FindBugs static analysis plugin for sbt.
Stars: ✭ 47 (+123.81%)
Mutual labels:  sbt, sbt-plugin
sbt-rewarn
Make sbt always display compilation warnings, even for unchanged files.
Stars: ✭ 42 (+100%)
Mutual labels:  sbt, sbt-plugin
sbt-graphql
SBT plugin to generate and validate graphql schemas written with Sangria
Stars: ✭ 94 (+347.62%)
Mutual labels:  sbt, sbt-plugin
sbt-bazel
Easily convert SBT projects to Bazel workspaces
Stars: ✭ 55 (+161.9%)
Mutual labels:  sbt, sbt-plugin
sbt-babel
An SBT plugin to perform Babel compilation.
Stars: ✭ 12 (-42.86%)
Mutual labels:  sbt, sbt-plugin
sbt-sonar
An sbt plugin which provides an easy way to integrate Scala projects with SonarQube.
Stars: ✭ 62 (+195.24%)
Mutual labels:  sbt, sbt-plugin
chuckwagon
a Scala/sbt AWS Lambda Toolkit
Stars: ✭ 29 (+38.1%)
Mutual labels:  sbt, sbt-plugin
sbt-kubeyml
Sbt plugin to help deploy Scala applications to Kubernetes
Stars: ✭ 37 (+76.19%)
Mutual labels:  sbt, sbt-plugin

sbt-publish-more

This SBT plugin allows you to publish artifacts to more than one repository.

It's inspired by the sbt-multi-publish plugin, which is unfortunately completely outdated and uses another, more limited approach.

It may be useful to be able to publish your project to several repositories at once, for example:

  • to the community Bintray repository
  • to your company's private server
  • to some local/proxy repository

But the publishTo setting accepts only one resolver. This is where this plugin comes to the rescue!

Usage

Add plugin to your project/plugins.sbt:

addSbtPlugin("laughedelic" % "sbt-publish-more" % "<version>")

(see the latest release version on the badge above)

Requirements: This plugins requires sbt 1.x

NOTE: This plugin is in active development, so things are likely to change. Check release notes and usage section in the Readme every time you update to a new version.

TL;DR

  1. Set publishResolvers := Seq(...)
  2. Call publishAll task

Multiple publish resolvers

If you want to publish to several repositories you just need to set the publishResolvers setting. For the example from above it will look like this:

publishResolvers := Seq(
  publishTo.in(bintray).value,
  Resolver.url("my-company-repo", url("https://company.com/releases/")),
  Resolver.file("my-local-repo", file("path/to/my/local/maven-repo"))
)

See sbt documentation for more types of resolvers.

Setting publishResolvers will also set publishTo to the first resolver in the list.

Now you can call publishAll task to publish to every resolver in the publishResolvers list. Note that if you want it to be the default behavior, you should change the standard publish task:

publish := publishAll.value

Different publish configurations (experimental)

By default it will publish to each repository with the same default publish configuration (that is stored in the publishConfiguration setting), as if you would call normal publish task several times while manually changing publishTo setting.

But you may want to publish to different repositories with different configurations. For example, maven-style vs. ivy-style patterns, or different sets of artifacts. So this plugin adds a setting publishCustomConfigs, which stores a mapping of Resolvers to their corresponding PublishConfigurations.

Say you want to publish to one repository maven-style (default) and to the other ivy-style. First, you should define your publish resolvers (in build.sbt):

lazy val repo1 = Resolver.file("repo1",  file("example/repo1"))
lazy val repo2 = Resolver.file("repo2",  file("example/repo2"))(Resolver.ivyStylePatterns)

publishResolvers := Seq(repo1, repo2)

It's better to define values for resolvers, because we will need to refer to them in the next step. The second one needs explicit ivy-style patterns, because the default is maven-style.

Then we add a custom configuration for repo2:

publishCustomConfigs ++= Map(
  repo2 -> publishConfiguration.value.withPublishMavenStyle(false)
)

This will make it generate the ivy.xml artifact. Now when you call publishAll you will get your maven-style artifacts in repo1 and ivy-style artifacts (with ivy.xml) in repo2.

You can change any other PublishConfiguration parameters this way and do it for every particular repository you want to publish to.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].