Reputation: 2878
I am trying to create a Task for SBT, so when I type "deploy" the task creates a .jar and then deploys it via SCP (I need an SSH library). The problem I'm struggling with is that I don't know know to add a library dependency (an SSH library) for build.sbt itself. I have
libraryDependencies += "org.apache.commons" % "commons-vfs2" % "2.2"
but this makes the library available to the project code, not the the SBT script "build.sbt" where I have to define the task.
Upvotes: 1
Views: 2199
Reputation: 22895
You have two options:
First, if you plan to re-implement the same functionality in multiple projects, the best thing to do would be to create your own sbt plugin - it is basically just another scala project, thus you add the dependency in the build.sbt
of that project.
Second, if you only need it for one project, and don't want to publish a plugin for it. SBT is recursive that means you can modify the SBT used to manage your project. This way you need to add your dependency to ./project/build.sbt
instead of ./build.sbt
- also I would recommend you write your task in a Scala file inside project
.
Upvotes: 3
Reputation: 8036
That sounds exactly like what's an sbt plugin ! Effectively a "sbt library".
For example, maybe https://github.com/shmishleniy/sbt-deploy-ssh would be of help to you ?
To use them, you'll need to edit the plugins.sbt
file, not the build.sbt
one
For example, for this ssh one, you'll need to add to your plugins.sbt
file :
resolvers += "JAnalyse Repository" at "http://www.janalyse.fr/repository/"
addSbtPlugin("com.github.shmishleniy" % "sbt-deploy-ssh" % "0.1.4")
Upvotes: 2