sbt - How to extract dependency jar to specific folder during compilation? -
sbt - How to extract dependency jar to specific folder during compilation? -
these project's dependencies:
librarydependencies ++= seq( javajdbc, javaebean, cache, javaws, "com.company" % "common_2.11" % "2.3.3" )
in com.company.common_2.11-2.3.3
there jar file common_2.11-2.3.3-adtnl.jar
.
how can during compilation process in build.sbt
tell sbt extract contents specific folder in project?
use next in build.sbt
:
def unpackjar(jar: file, to: file): file = { println(s"processing $jar , saving $to") io.unzip(jar, to) jar } resourcegenerators in compile += def.task { val jar = (update in compile).value .select(configurationfilter("compile")) .filter(_.name.contains("common")) .head val = (target in compile).value / "unjar" unpackjar(jar, to) seq.empty[file] }.taskvalue
it assumes "common"
unique part amongst of dependencies. you'd need prepare filter
otherwise.
it assumes don't want files @ compile
, bit later when package
called. you'd need move code between def.task{...}
compile in compile
block like:
compile in compile <<= (compile in compile).dependson(def.task { val jar = (update in compile).value .select(configurationfilter("compile")) .filter(_.name.contains("common")) .head val = (target in compile).value / "unjar" unpackjar(jar, to) seq.empty[file] })
sbt
Comments
Post a Comment