scala项目编译错误
我要上scala课程。我下载了示例项目,但无法编译它。运行console命令时出现错误 build.sbt:scala项目编译错误,scala,compiler-errors,sbt,Scala,Compiler Errors,Sbt,我要上scala课程。我下载了示例项目,但无法编译它。运行console命令时出现错误 build.sbt: name := course.value + "-" + assignment.value scalaVersion := "2.12.4" scalacOptions ++= Seq("-deprecation") // grading libraries libraryDependencies += "junit" % "junit" % "4.10" % Test // f
name := course.value + "-" + assignment.value
scalaVersion := "2.12.4"
scalacOptions ++= Seq("-deprecation")
// grading libraries
libraryDependencies += "junit" % "junit" % "4.10" % Test
// for funsets
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases"
// include the common dir
commonSourcePackages += "common"
courseId := "bRPXgjY9EeW6RApRXdjJPw"
错误:
> console
[info] Updating root
[info] Resolved root dependencies
[trace] Stack trace suppressed: run last *:coursierResolution for the full output.
[error] (*:coursierResolution) coursier.ResolutionException: Encountered 1 error(s) in dependency resolution:
[error] org.scalatest:scalatest_2.12:2.2.4:
[error] not found:
[error] /Users/joaonobre/.ivy2/local/org.scalatest/scalatest_2.12/2.2.4/ivys/ivy.xml
[error] /Users/joaonobre/.sbt/preloaded/org.scalatest/scalatest_2.12/2.2.4/ivys/ivy.xml
[error] /Users/joaonobre/.sbt/preloaded/org/scalatest/scalatest_2.12/2.2.4/scalatest_2.12-2.2.4.pom
[error] https://repo1.maven.org/maven2/org/scalatest/scalatest_2.12/2.2.4/scalatest_2.12-2.2.4.pom
[error] http://repo.artima.com/releases/org/scalatest/scalatest_2.12/2.2.4/scalatest_2.12-2.2.4.pom
[error] Total time: 1 s, completed Dec 22, 2017 4:16:17 PM
scala -version
Scala code runner version 2.12.4 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.
知道怎么修吗
谢谢。正如@laughedelic所建议的,Scala 2.12没有scalatest-2.2.4。因此,sbt找不到相关的scalatest pom文件。您可以选择提到的任何版本 例如,尝试在CommonBuild.scala文件中将scalaTestDependency版本更改为3.0.5
lazy val scalaTestDependency = "org.scalatest" %% "scalatest" % "3.0.5"
这是本课程(第一周的实践编程作业)您确定本课程使用Scala 2.12吗?错误告诉您,它无法解析Scala 2.12对scalatest-2.2.4的依赖关系(可能是因为只有scalatest-3.+可用于2.12)。同时您正在使用junit。因此,请提供课程的链接,然后我可以检查与官方设置说明的区别。