How can I import the SBT project library from GitHub into a local directory?

I unzipped the Scala library from GitHub and I want to import it into another project.

How can I tell sbt where to find this package?

For example, I am writing a program in ~/code/scala/myProgram, and I want to import a library from ~/code/scala/otherlib.

+4
source share
2 answers

If it is supported by the cloned project (that is, if it supports SBT and is configured for publication in the repository), you can publish it locally with the sbt command sbt publish-local, For example:

cd ~/code/scala/otherlib
sbt publish-local

Ivy ( ~/.ivy2/local). , , otherlib.

, Ivy, otherlib SBT, SBT ( , ID, , ..). , :

libraryDependencies += "com.some_company" % "otherlib" % "1.0.0"

build.sbt .

, , otherlib Ivy ( ) .

otherlib SBT , , , .jar /lib (~/code/scala/myProgram/lib) .

+10

SBT git . - clone checkout. . SBT git uri ( )? git SBT?, build.sbt:

lazy var gitRepo = "git:file:///Users/jacek/sandbox/so/sbt-git/git-repo/#master"

lazy val g = RootProject(uri(gitRepo))

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

( ), - git -hosted - .

+7

Source: https://habr.com/ru/post/1531985/


All Articles