Copy a single dependency jar into a folder via build.sbt

一个人想着一个人 提交于 2019-12-04 17:04:44

You could declare a new configuration Stage. You could set libraryDependencies to the desired value in that configuration. Later your stage task could read update report and copy the files to the desired directory.

val stage = taskKey[Unit]("Stage task")

val Stage = config("stage")

val root = project.in(file(".")).configs(Stage).settings( inConfig(Stage)(Classpaths.ivyBaseSettings): _* )

libraryDependencies in Stage := Seq("com.newrelic.agent.java" % "newrelic-api" % "3.7.0")

stage := {
  (update in Stage).value.allFiles.foreach { f =>
    IO.copyFile(f, baseDirectory.value / f.getName)
  }
}

You can checkout a working example in my github repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!