Tvaroh
Tvaroh

Reputation: 6763

SBT: how to include both ordinary jar and test-jar of same dependency

In my SBT descriptor I have:

libraryDependencies ++= Seq(
  "org.neo4j" % "neo4j-kernel" % neo4jVersion,
  "org.neo4j" % "neo4j-kernel" % neo4jVersion % "test" classifier "tests" // test-jar
)

With this setup I don't get test-jar dependency (second line). But if I remove the first line, than test-jar dependency is in place.

How to include both dependencies?

Upvotes: 9

Views: 2428

Answers (1)

Rob Starling
Rob Starling

Reputation: 3908

Are you trying to get test-jar available for your main ("compile") code? Or for your test code?

As per http://www.scala-sbt.org/release/docs/Detailed-Topics/Library-Management.html#ivy-configurations , if you're trying to get the test config of something else available for your main code, you'll need something like % "compile->test" (my 'compile' uses their 'test').

e.g. if you wanted both in main,

"org.neo4j" % "neo4j-kernel" % neo4jVersion
"org.neo4j" % "neo4j-kernel" % neo4jVersion classifier "tests" % "compile->test"

or if you just want the latter in test, try shuffling the order of classifier and % "test" maybe?

"org.neo4j" % "neo4j-kernel" % neo4jVersion
"org.neo4j" % "neo4j-kernel" % neo4jVersion classifier "tests" % "test"

Do paste show compile:dependencyClasspath vs show test:dependencyClasspath (at the sbt prompt)

Upvotes: 2

Related Questions