diff --git a/sbt-coursier/src/main/scala-2.10/coursier/ResolutionException.scala b/sbt-coursier/src/main/scala-2.10/coursier/ResolutionException.scala index 9f8925a91..f083c0ea3 100644 --- a/sbt-coursier/src/main/scala-2.10/coursier/ResolutionException.scala +++ b/sbt-coursier/src/main/scala-2.10/coursier/ResolutionException.scala @@ -4,7 +4,9 @@ final class ResolutionException( val error: ResolutionError ) extends Exception( error.message, - error.cause.orNull, - true, - false // don't keep stack trace around (improves readability from the SBT console) -) + error.cause.orNull +) { + // not using the 4-arg Exception constructor, only available with Java >= 7 + + setStackTrace(Array()) // don't keep stack trace around (improves readability from the SBT console) +} diff --git a/scripts/travis.sh b/scripts/travis.sh index 684b29f94..7e54f8d8d 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh @@ -110,7 +110,8 @@ testLauncherJava6() { } testSbtCoursierJava6() { - sbt ++${SCALA_VERSION} publishLocal + sbt ++${SCALA_VERSION} coreJVM/publishLocal cache/publishLocal sbt-coursier/publishLocal + git clone https://github.com/alexarchambault/scalacheck-shapeless.git cd scalacheck-shapeless cd project @@ -126,6 +127,23 @@ testSbtCoursierJava6() { openjdk:6-jre \ /bin/bash -c "cd /root/project && /root/bin/sbt update" cd .. + + # ensuring resolution error doesn't throw NoSuchMethodError + mkdir -p foo/project + cd foo + echo 'libraryDependencies += "foo" % "bar" % "1.0"' >> build.sbt + echo 'addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-SNAPSHOT")' >> project/plugins.sbt + echo 'sbt.version=0.13.15' >> project/build.properties + docker run -it --rm \ + -v $HOME/.ivy2/local:/root/.ivy2/local \ + -v $(pwd):/root/project \ + -v $(pwd)/../bin:/root/bin \ + -e CI=true \ + openjdk:6-jre \ + /bin/bash -c "cd /root/project && /root/bin/sbt update || true" | tee -a output + grep "coursier.ResolutionException: Encountered 1 error" output + echo "Ok, found ResolutionException in output" + cd .. } clean_plugin_sbt() {