Skip to content

Commit a2b3e49

Browse files
committed
Merge pull request #6 from adriaanm/f--king-classpath
Fork in test to work around classpath issues
2 parents 841bb02 + daa743a commit a2b3e49

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/main/scala/ScalaModulePlugin.scala

+22
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ object ScalaModulePlugin extends Plugin {
2525
// to allow compiling against snapshot versions of Scala
2626
resolvers += Resolver.sonatypeRepo("snapshots"),
2727

28+
// resolvers += "scala-release-temp" at "http://private-repo.typesafe.com/typesafe/scala-release-temp/"
29+
2830
// don't use for doc scope, scaladoc warnings are not to be reckoned with
2931
// TODO: turn on for nightlies, but don't enable for PR validation... "-Xfatal-warnings"
3032
scalacOptions in compile ++= Seq("-optimize", "-feature", "-deprecation", "-unchecked", "-Xlint"),
@@ -44,6 +46,13 @@ object ScalaModulePlugin extends Plugin {
4446
(baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties"
4547
},
4648

49+
// needed to fix classloader issues (see scala/scala-xml#20)
50+
// essentially, the problem is that the run-time bootclasspath leaks into the compilation classpath,
51+
// so that scalac see classes used to run it, as classes used to compile against...
52+
// forking uses a minimal classpath, so this craziness is avoided
53+
// alternatively, manage the scala instance as shown at the end of this file (commented)
54+
fork in Test := true,
55+
4756
publishArtifact in Test := false,
4857

4958
// maven publishing
@@ -103,3 +112,16 @@ object ScalaModulePlugin extends Plugin {
103112
// import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
104113
// previousArtifact := Some(organization.value %% name.value % binaryReferenceVersion.value)
105114
}
115+
116+
117+
// ALTERNATIVE to fork in test for fixing classpath issues noted above:
118+
// manage the Scala instance ourselves to exclude the published scala-xml (scala-compiler depends on it)
119+
// since this dependency hides the classes we're testing
120+
// managedScalaInstance := false
121+
//
122+
// ivyConfigurations += Configurations.ScalaTool
123+
//
124+
// libraryDependencies ++= Seq(
125+
// "org.scala-lang" % "scala-library" % scalaVersion.value,
126+
// ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "scala-tool").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}")
127+
// )

0 commit comments

Comments
 (0)