In SBT, how to use addSbtPlugin with a Github URL?
Asked Answered
L

2

11

Currently, I used a plugin like this:

addSbtPlugin("com.tuplejump" % "sbt-yeoman" % "0.7.1")

But then, I fork this plugin on github (let's say https://github.com/myname/play-yeoman.git) and make some changes, what would be an easier way to use my forked version of plugin? Do I really have to register this fork on a maven/ivy repository?

Thanks!

Lanlana answered 8/3, 2015 at 9:20 Comment(2)
What about using lazy val yeomanPlugin = uri("sit://github.com/myname/play-yeoman") as mentioned in sbt docs? Are you working on a sbt plugin?Rhettrhetta
Just to complement Nader comment: 1d) Project dependency - sbt docsAlboin
V
6

Using SBT 0.13.8, I was able to replace the following line in my ./project/plugins.sbt:

addSbtPlugin("net.ground5hark.sbt" %% "sbt-concat" % "0.1.8")

with the following two lines

lazy val root = (project in file(".")).dependsOn(concatPlugin)

lazy val concatPlugin = uri("https://github.com/ground5hark/sbt-concat.git#342acc34195438799b8a278fda94b126238aae17")

No other steps were necessary. Also, note that the git URI has a commit hash on the end. This is very useful for ensuring a known-to-work, specific version of the source is used in the project, rather than whatever the latest unknown state of the source is.

Vicennial answered 29/12, 2015 at 20:17 Comment(2)
How does it work when the GitHub repo is private? How can I provide user/password or ssh key?Raiment
@mkurz, never done it myself, but this link seems to have a few solutions: https://mcmap.net/q/1158407/-sbt-project-depending-on-a-external-amp-private-github-repositoryVicennial
R
1

Follow this steps:

  1. Add -SNAPSHOT suffix to the version of the plugin, i.e. version := "1.0.0-SNAPSHOT"
  2. Run sbt publishLocal from the command line.
  3. Reference the snapshot version from your plugins.sbt.
Rajab answered 25/3, 2015 at 16:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.