Skip to content

Commit 150874e

Browse files
xuwei-kashawley
authored andcommitted
Fix sbtApiMappings for Java 9
1 parent 1552f53 commit 150874e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

build.sbt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,18 @@ lazy val xml = crossProject.in(file("."))
2727

2828
apiMappings ++= Map(
2929
scalaInstance.value.libraryJar
30-
-> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/"),
30+
-> url(s"http://www.scala-lang.org/api/${scalaVersion.value}/")
31+
) ++ {
3132
// http://stackoverflow.com/questions/16934488
32-
file(System.getProperty("sun.boot.class.path").split(java.io.File.pathSeparator).filter(_.endsWith(java.io.File.separator + "rt.jar")).head)
33-
-> url("http://docs.oracle.com/javase/8/docs/api")
34-
)
33+
Option(System.getProperty("sun.boot.class.path")).flatMap { classPath =>
34+
classPath.split(java.io.File.pathSeparator).filter(_.endsWith(java.io.File.separator + "rt.jar")).headOption
35+
}.map { jarPath =>
36+
Map(
37+
file(jarPath)
38+
-> url("http://docs.oracle.com/javase/8/docs/api")
39+
)
40+
} getOrElse(Map.empty)
41+
}
3542
)
3643
.jvmSettings(
3744
OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"),

0 commit comments

Comments
 (0)