Dependency classifier is not resolved for Ivy
See original GitHub issueI have the dependency which is taken from Ivy repository but uses classifier, e.g.:
libraryDependencies ++= Seq(
"co.oops" %% "useless" % "0.0.1",
"co.oops" %% "useless" % "0.0.1" classifier "tests"
)
Dependency with tests
classifier is not resolved, or to be correct it is but it is not correctly put in class path.
I’ve prepared repo for simulation of the issue at https://github.com/teliatko/coursier-issue-ivy-classifiers
Procedure after checkout is:
$ cd useless
$ sbt publishLocal
$ cd ../issue
$ sbt
> update
> show fullClasspath
Dependency co.oops.useless
in on classpath only once and without classifier. Dependency tree produced by Coursier looks like this:
$ sbt
> coursierDependencyTree
issue
├─ co.oops:useless_2.11:0.0.1
| ├─ org.scala-lang:scala-library:2.11.8
| └─ org.scalactic:scalactic_2.11:3.0.1
| ├─ org.scala-lang:scala-library:2.11.8
| └─ org.scala-lang:scala-reflect:2.11.8
| └─ org.scala-lang:scala-library:2.11.8
├─ co.oops:useless_2.11:0.0.1
| ├─ org.scala-lang:scala-library:2.11.8
| └─ org.scalactic:scalactic_2.11:3.0.1
└─ org.scala-lang:scala-library:2.11.8
It shows co.oops:useless_2.11:0.0.1
twice and always without classifier tests
. So tests
classifier is somewhere lost along the way.
When I copy produced artifacts and pom into ~/.m2
and enable Resolver.mavenLocal
in issue/build.sbt
(of course leaving out Resolver.defaultLocal
) everything works.
The Resolver.defaultLocal
uses pattern (see SBT sources):
"[organisation]/[module]/" + PluginPattern + "[revision]/[type]s/[artifact](-[classifier]).[ext]"
Thus classifier
part is in. Default SBT resolution works with classifier
part correctly.
Side note: issue
build already contains workaround from #444
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:11 (3 by maintainers)
Top GitHub Comments
We had previously abandoned our move to Coursier because of this issue (and not being able to figure out how to solve it). Hadoop publishes loads of test classified JARs, but most notably the
hadoop-common
andhadoop-hdfs
JARs which contain (among other things) theMiniDFSCluster
class used for unit/integration testing Hadoop related things.Of course we can now follow the workaround presented in #444 but it’s a little icky at it should IMHO be the default to do this as it is in SBT plain.
sbt-coursier doesn’t resolve https://mvnrepository.com/artifact/com.sksamuel.elastic4s/elastic4s-testkit_2.11/2.3.1 dependency on
Which is required for embedded ES as it contains MockNode.class