Don't require adding type test-jar to classpathTypes

E.g. when adding dependencies with a tests classifier
This commit is contained in:
Trent Schmidt 2017-04-22 22:36:43 -07:00 committed by Alexandre Archambault
parent a7097556db
commit 16d27bb482
5 changed files with 35 additions and 1 deletions

View File

@ -158,7 +158,10 @@ object CoursierPlugin extends AutoPlugin {
Some(Configuration("docs", "", isPublic = true, extendsConfigs = Vector.empty, transitive = false))
confs ++ extraSources.toSeq ++ extraDocs.toSeq
}
},
// Tests artifacts from Maven repositories are given this type.
// Adding it here so that these work straightaway.
classpathTypes += "test-jar"
)
override lazy val buildSettings = super.buildSettings ++ Seq(

View File

@ -0,0 +1,2 @@
scalaVersion := "2.11.8"
libraryDependencies += "org.jclouds.api" % "nova" % "1.5.9" classifier "tests"

View File

@ -0,0 +1,11 @@
{
val pluginVersion = sys.props.getOrElse(
"plugin.version",
throw new RuntimeException(
"""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
)
)
addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion)
}

View File

@ -0,0 +1,17 @@
import java.io.File
import java.nio.file.Files
import scala.util.Try
object Main extends App {
def classFound(clsName: String) = Try(
Thread.currentThread()
.getContextClassLoader()
.loadClass(clsName)
).toOption.nonEmpty
val classifierTest = classFound("org.jclouds.openstack.nova.functions.ParseServerFromJsonResponseTest")
assert(classifierTest, s"Couldn't find classifierTest")
}

View File

@ -0,0 +1 @@
> run