diff --git a/ivy/Ivy.scala b/ivy/Ivy.scala
index e5ab87aa9..701b8fb1d 100644
--- a/ivy/Ivy.scala
+++ b/ivy/Ivy.scala
@@ -142,7 +142,7 @@ final class IvySbt(val configuration: IvyConfiguration)
{
val mod = new DefaultModuleDescriptor(IvySbt.toID(module), "release", null, false)
mod.setLastModified(System.currentTimeMillis)
- configurations.foreach(config => mod.addConfiguration(IvySbt.toIvyConfiguration(config)))
+ IvySbt.addConfigurations(mod, configurations)
IvySbt.addArtifacts(mod, module.explicitArtifacts)
mod
}
@@ -151,7 +151,9 @@ final class IvySbt(val configuration: IvyConfiguration)
private def readPom(pomFile: File, validate: Boolean) =
{
val md = PomModuleDescriptorParser.getInstance.parseDescriptor(settings, toURL(pomFile), validate)
- (IvySbt.toDefaultModuleDescriptor(md), "compile")
+ val dmd = IvySbt.toDefaultModuleDescriptor(md)
+ IvySbt.addConfigurations(dmd, Configurations.defaultInternal)
+ (dmd, "compile")
}
/** Parses the given Ivy file 'ivyFile'.*/
private def readIvyFile(ivyFile: File, validate: Boolean) =
@@ -408,6 +410,8 @@ private object IvySbt
def addArtifacts(moduleID: DefaultModuleDescriptor, artifacts: Iterable[Artifact]): Unit =
for(art <- mapArtifacts(moduleID, artifacts.toSeq); c <- art.getConfigurations)
moduleID.addArtifact(c, art)
+ def addConfigurations(mod: DefaultModuleDescriptor, configurations: Iterable[Configuration]): Unit =
+ configurations.foreach(config => mod.addConfiguration(toIvyConfiguration(config)))
def mapArtifacts(moduleID: ModuleDescriptor, artifacts: Seq[Artifact]): Seq[IArtifact] =
{
diff --git a/sbt/package.scala b/sbt/package.scala
index 22472eb29..46bfc5a47 100644
--- a/sbt/package.scala
+++ b/sbt/package.scala
@@ -17,20 +17,20 @@ package object sbt extends sbt.std.TaskExtra with sbt.Types with sbt.ProcessExtr
def file(s: String): File = new File(s)
def url(s: String): URL = new URL(s)
- def ThisScope = Scope.ThisScope
- def GlobalScope = Scope.GlobalScope
+ final val ThisScope = Scope.ThisScope
+ final val GlobalScope = Scope.GlobalScope
import sbt.{Configurations => C}
- def Compile = C.Compile
- def Test = C.Test
- def Runtime = C.Runtime
- def IntegrationTest = C.IntegrationTest
- def Default = C.Default
- def Docs = C.Docs
- def Sources = C.Sources
- def Provided = C.Provided
+ final val Compile = C.Compile
+ final val Test = C.Test
+ final val Runtime = C.Runtime
+ final val IntegrationTest = C.IntegrationTest
+ final val Default = C.Default
+ final val Docs = C.Docs
+ final val Sources = C.Sources
+ final val Provided = C.Provided
// java.lang.System is more important, so don't alias this one
-// def System = C.System
- def Optional = C.Optional
+// final val System = C.System
+ final val Optional = C.Optional
def config(s: String): Configuration = Configurations.config(s)
}
diff --git a/sbt/src/sbt-test/dependency-management/pom-classpaths/pom.xml b/sbt/src/sbt-test/dependency-management/pom-classpaths/pom.xml
new file mode 100644
index 000000000..20162df7e
--- /dev/null
+++ b/sbt/src/sbt-test/dependency-management/pom-classpaths/pom.xml
@@ -0,0 +1,27 @@
+
+ 4.0.0
+ org.example
+ sbt-pom
+ 1.0-SNAPSHOT
+
+
+ org.scalatest
+ scalatest_2.9.0
+ 1.6.1
+ test
+
+
+ org.scala-lang
+ scala-library
+ 2.9.0-1
+ compile
+
+
+ javax.servlet
+ servlet-api
+ 2.5
+ provided
+
+
+
diff --git a/sbt/src/sbt-test/dependency-management/pom-classpaths/project/Build.scala b/sbt/src/sbt-test/dependency-management/pom-classpaths/project/Build.scala
new file mode 100644
index 000000000..70ec59ae6
--- /dev/null
+++ b/sbt/src/sbt-test/dependency-management/pom-classpaths/project/Build.scala
@@ -0,0 +1,37 @@
+import sbt._
+import Keys._
+import complete._
+import complete.DefaultParsers._
+
+object MyBuild extends Build
+{
+ lazy val root = Project("root", file(".")) settings( externalPom() :_*) settings(
+ scalaVersion := "2.9.0-1",
+ check <<= checkTask,
+ managedClasspath in Provided <<= (classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }
+ )
+
+ def checkTask = InputTask(_ => parser ) { result =>
+ (result, managedClasspath in Provided, fullClasspath in Compile, fullClasspath in Test, fullClasspath in Runtime) map { case ((conf, names), p, c, t, r) =>
+ println("Checking: " + conf.name)
+ checkClasspath(conf match {
+ case Provided => p
+ case Compile => c
+ case Test => t
+ case Runtime => r
+ }, names.toSet)
+ }
+ }
+
+ lazy val check = InputKey[Unit]("check")
+ def parser: Parser[(Configuration,Seq[String])] = (Space ~> token(cp(Compile) | cp(Runtime) | cp(Provided) | cp(Test))) ~ spaceDelimited("")
+ def cp(c: Configuration): Parser[Configuration] = c.name ^^^ c
+ def checkClasspath(cp: Seq[Attributed[File]], names: Set[String]) =
+ {
+ val fs = cp.files filter { _.getName endsWith ".jar" }
+ val intersect = fs filter { f => names exists { f.getName startsWith _ } }
+ assert(intersect == fs, "Expected:" + seqStr(names.toSeq) + "Got: " + seqStr(fs))
+ ()
+ }
+ def seqStr(s: Seq[_]) = s.mkString("\n\t", "\n\t", "\n")
+}
\ No newline at end of file
diff --git a/sbt/src/sbt-test/dependency-management/pom-classpaths/test b/sbt/src/sbt-test/dependency-management/pom-classpaths/test
new file mode 100644
index 000000000..19be5b835
--- /dev/null
+++ b/sbt/src/sbt-test/dependency-management/pom-classpaths/test
@@ -0,0 +1,3 @@
+> check test scalatest scala-library.jar servlet-api
+> check runtime scala-library
+> check compile scala-library servlet-api
\ No newline at end of file