How can I use library dependency in sbt task definition?

I define an sbt task that should call code in a library. Here is the build.sbt file with what I have tried so far:

libraryDependencies ++= Seq("com.some.company" %% "some-lib" % "1.0.0") val doSomething = taskKey[Unit]("does something") doSomething := { import com.some.company.function function() } 

Import does not work. How to define a task that depends on the code in an external library?

+6
source share
1 answer

To create the .sbt file in the root directory, SBT uses the information in the project directory. So put build.sbt in the project directory and set libraryDependencies there:

 libraryDependencies ++= Seq("com.some.company" %% "some-lib" % "1.0.0") 

So, to clarify, now you have two build.sbt :

  • ./build.sbt
  • ./project/build.sbt
+8
source

All Articles