Reputation: 585
During the stage
task, I'd like sbt
to grab the newrelic jar from the ivy repos and copy it into a folder. Ideally, the jar is configured the same way dependencies are, but not necessarily within the libraryDependencies
Seq
itself (as it's not a build or runtime dependency).
Upvotes: 4
Views: 1937
Reputation: 13749
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
Upvotes: 4