如何安装 sbt-eclipse 插件?
Posted
技术标签:
【中文标题】如何安装 sbt-eclipse 插件?【英文标题】:How to install sbt-eclipse plugin? 【发布时间】:2020-03-06 03:07:17 【问题描述】:我已经按照 sbt 文档了解如何安装 sbt-eclipse 插件,但我一直在 sbt shell 中遇到错误。
我使用的是 Windows 10 Pro、sbt v1.3.3 和 Eclipse v4.7.0(在 ~\Documents\eclipse 中)。
我的 hello-world\build.sbt 文件非常简单:
scalaVersion := "2.13.1"
name := "hello-world"
organization := "ch.epfl.scala"
version := "1.0"
libraryDependencies += "org.typelevel" %% "cats-core" % "2.0.0"
而我的 hello-world\project\plugins.sbt 文件只有一行:
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.1.0")
sbt shell 中 eclipse 命令出错:
sbt:hello-world> eclipse
[error] Expected ';'
[error] Not a valid command: eclipse (similar: client, help, alias)
[error] Not a valid project ID: eclipse
[error] Expected ':'
[error] Not a valid key: eclipse (similar: deliver, licenses, clean)
[error] eclipse
[error] ^
在 sbt shell 中编译时出错:
sbt:hello-world> compile
Nov 09, 2019 2:19:40 PM lmcoursier.internal.shaded.coursier.cache.shaded.org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
[info] Updating
[info] Resolved dependencies
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.typesafe.sbteclipse:sbteclipse-plugin:5.1.0 (sbtVersion=1.0, scalaVersion=2.13)
[warn]
[warn] Note: Unresolved dependencies path:
[error] stack trace is suppressed; run last update for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading com.typesafe.sbteclipse:sbteclipse-plugin;sbtVersion=1.0;scalaVersion=2.13:5.1.0
[error] Not found
[error] Not found
[error] not found: C:\Users\colin\.ivy2\local\com.typesafe.sbteclipse\sbteclipse-plugin\scala_2.13\sbt_1.0\5.1.0\ivys\ivy.xml
[error] not found: https://repo1.maven.org/maven2/com/typesafe/sbteclipse/sbteclipse-plugin_2.13_1.0/5.1.0/sbteclipse-plugin-5.1.0.pom
[error] Total time: 1 s, completed Nov 9, 2019 2:19:41 PM
【问题讨论】:
【参考方案1】:使用最新版本的插件并重新开始。
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")
见https://github.com/sbt/sbteclipse。
【讨论】:
以上是关于如何安装 sbt-eclipse 插件?的主要内容,如果未能解决你的问题,请参考以下文章