pprados
pprados

Reputation: 1127

How to declare zip dependency and know its path in file system?

I would like to download a zip artifact and find the corresponding file in local repository.

Where I can declare the zip extension ?

libraryDependencies ++= Seq(
    "com.acme" % "audit-agent" % "0.7" % "test" // ??? where I put zip ?
)

May be, I can just use some object to reference the artifact, download it, and file the filename ?

Any Idea ?

Upvotes: 2

Views: 454

Answers (2)

AlexY
AlexY

Reputation: 96

There is a more native way:

libraryDependencies += "org" % "name" % "rev" artifacts(Artifact("name", "type", "ext"))

or in your case

libraryDependencies ++= Seq(
"com.acme" % "audit-agent" % "0.7" % "test" artifacts(Artifact("audit-agent", "zip", "zip")))

Upvotes: 0

Jacek Laskowski
Jacek Laskowski

Reputation: 74679

Use from method of sbt.ModuleID in libraryDependencies as described in Explicit URL:

libraryDependencies += "organization" % "myModuleName" % "1.0" from "https://myhost.pl/slinky.zip"

Then follow How to extract dependency jar to specific folder during compilation? and use update and .filter:

val jar = (update in Compile).value
            .select(configurationFilter("compile"))
            .filter(_.name.contains("myModuleName"))
            .head

Upvotes: 3

Related Questions