如何使用SBT将MATSim添加到我的Scala项目中



我正在尝试将MATSim与Scala和SBT一起使用。但是,如果没有编译错误,我就无法添加依赖项。MATSim使用Maven,但我想将它添加到我的SBT项目中。这是我的大楼

name := "matsim-console"
version := "0.1"
scalaVersion := "2.13.7"
lazy val matsimVersion = "13.0"
resolvers += "osgeo" at "https://repo.osgeo.org/repository/release/"
resolvers += "matsim" at "https://repo.matsim.org/repository/matsim"
resolvers += "jogl" at "https://dl.bintray.com/matsim/matsim/"
resolvers += Resolver.url("jogl1", url("https://mvnrepository.com/artifact/"))( Patterns("[organisation]/[module]/[revision]/[artifact].[ext]") )
lazy val proj = (project in file("."))
.settings(
libraryDependencies += "org.jogamp.jogl" % "jogl-all" % "2.4.0-matsim-1",
libraryDependencies += "org.jogamp.gluegen" % "gluegen-rt" % "2.3.2",
libraryDependencies += "org.matsim" % "matsim" % matsimVersion,
libraryDependencies += "org.matsim.contrib" % "vsp" % matsimVersion,
)

1-为什么我需要将jog-allgluegen-rt的依赖项添加到我的Scala项目中?SBT不应该导入MATSim及其所有依赖项吗?

2-为什么最后一个依赖项不起作用?我得到这个错误:

[error] stack trace is suppressed; run last update for the full output
[error] (update) lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-solaris-amd64.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-solaris-amd64.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-android-armv6.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-android-armv6.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-linux-armv6.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-linux-armv6.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-solaris-i586.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-solaris-i586.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-android-armv6.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-android-armv6.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-linux-armv6hf.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-linux-armv6hf.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-linux-armv6.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-linux-armv6.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-linux-armv6hf.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-linux-armv6hf.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-android-aarch64.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-android-aarch64.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-solaris-i586.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-solaris-i586.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-android-aarch64.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/jogl/jogl-all/2.4.0-matsim-1/jogl-all-2.4.0-matsim-1-natives-android-aarch64.jar
[error] https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-solaris-amd64.jar: not found: https://repo.matsim.org/repository/matsim/org/jogamp/gluegen/gluegen-rt/2.4.0-matsim-1/gluegen-rt-2.4.0-matsim-1-natives-solaris-amd64.jar

为什么我需要将jog-all和gluegen-rt的依赖项添加到我的Scala项目中?SBT不应该导入MatSim及其所有依赖项吗?

右。你不需要,这就是像SBT这样的依赖性管理工具的目的。只需直接添加所需的依赖项,即可自动提取可传递的依赖项。

为什么最后一个依赖项不起作用?我收到这个错误

因为它在寻找一个不存在的依赖项(或者至少不在您提供的存储库中(。

您应该使用sbt dependencyTree(或变体(来更好地查看依赖关系,并了解为什么需要此依赖关系。

当我切换到Java 11时,它正常工作。

最新更新