gpt4 book ai didi

eclipse - 如何使用sbt-eclipse创建项目的Eclipse项目文件?

转载 作者:行者123 更新时间:2023-12-02 08:35:21 25 4
gpt4 key购买 nike

我关注了the official documentation在我的 sbt 项目中设置插件:

  1. 添加了 addSbtPlugin("com.typesafe.sbteclipse"% "sbteclipse-plugin"%
    "2.5.0")
    ~/.sbt/plugins/plugins.sbt 文件
  2. cd编辑到项目并运行sbt
  3. 在 sbt shell 中,输入 eclipse

这就是我遇到以下错误的地方:

> eclipse
[error] Not a valid command: eclipse (similar: help, alias)
[error] Not a valid project ID: eclipse (similar: sbteclipse)
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: eclipse (similar: deliver, licenses, clean)
[error] eclipse
[error] ^

我错过了什么?

预先感谢您能给我的任何帮助。

$ /opt/sbt-0.13.5/bin/sbt
[warn] The global sbt directory is now versioned and is located at /Users/first.last/.sbt/0.13.
[warn] You are seeing this warning because there is global configuration in /Users/first.last/.sbt but not in /Users/first.last/.sbt/0.13.
[warn] The global sbt directory may be changed via the sbt.global.base system property.
[info] Loading project definition from /Users/first.last/git/myproject/project
[info] Set current project to myproject (in build file:/Users/first.last/git/myproject/)
> eclipse
[error] Not a valid command: eclipse (similar: help, alias)
[error] Not a valid project ID: eclipse
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: eclipse (similar: deliver, licenses, clean)
[error] eclipse
[error] ^

最佳答案

我正在使用 sbt 0.13.5。

$ sbt --version
sbt launcher version 0.13.5

目录中执行sbt about来检查build/sbt设置。

$ sbt about
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Updating {file:/Users/jacek/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to sbteclipse (in build file:/Users/jacek/sandbox/sbteclipse/)
[info] This is sbt 0.13.5
[info] The current project is {file:/Users/jacek/sandbox/sbteclipse/}sbteclipse 0.1-SNAPSHOT
[info] The current project is built against Scala 2.10.4
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, net.virtualvoid.sbt.graph.Plugin, com.timushev.sbt.updates.UpdatesPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.4

目录中没有文件(忽略target,因为它是由 sbt 在启动时自动创建的,并且可以随时删除)。

$ tree
.
`-- target

1 directory, 0 files

然后,我使用 sbt 运行 sbt shell,以确保不存在 eclipse 命令。

$ sbt
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Set current project to sbteclipse (in build file:/Users/jacek/sandbox/sbteclipse/)
> eclipse
[error] Not a valid command: eclipse (similar: help, alias)
[error] Not a valid project ID: eclipse (similar: sbteclipse)
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: eclipse (similar: deliver, licenses, clean)
[error] eclipse
[error] ^

我可以重现您的问题。继续设置插件 - 我没有关闭 sbt shell。

按照文档紧密,我打开~/.sbt/0.13/plugins/plugins.sbt,如下所示:

$ cat ~/.sbt/0.13/plugins/plugins.sbt
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")

使用文件中的插件,我在 sbt shell 中触发了 reload 来加载更改。

> reload
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Updating {file:/Users/jacek/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to sbteclipse (in build file:/Users/jacek/sandbox/sbteclipse/)
> eclipse
[info] About to create Eclipse project files for your project(s).
[info] Updating {file:/Users/jacek/sandbox/sbteclipse/}sbteclipse...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Successfully created Eclipse project files for project(s):
[info] sbteclipse

如您所见,插件已正确加载并生成文件。按照步骤操作,您应该可以顺利安装插件。

关于eclipse - 如何使用sbt-eclipse创建项目的Eclipse项目文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24687698/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com