如何使用sbt-eclipse创建项目的Eclipse项目文件? [英] How to use sbt-eclipse to create Eclipse project files of a project?
问题描述
我遵循官方文档在我的sbt项目中设置插件:
$添加 addSbtPlugin(com.typesafe.sbteclipse%sbteclipse-plugin%
2.5.0)b
$ b <
到〜/ .sbt / plugins / plugins.sbt
文件 cd
编辑到项目并运行 sbt
eclipse
这是我面临以下错误的地方:
> eclipse
[错误]不是有效的命令:eclipse(类似:help,别名)
[错误]不是有效的项目ID:eclipse(类似:sbteclipse)
[error] '(如果选择一个配置)
[error]不是一个有效的密钥:eclipse(类似:deliver,licenses,clean)
[error] eclipse
[error] ^
我缺少什么?
提前感谢任何帮助你可以给我。
$ /opt/sbt-0.13.5/bin/sbt
[warn]全局sbt目录现在版本化,位于/Users/first.last/.sbt/0.13。
[warn]您看到此警告,因为/Users/first.last/.sbt中没有全局配置,但不在/Users/first.last/.sbt/0.13中。
[warn]可以通过sbt.global.base系统属性更改全局sbt目录。
[info]从/Users/first.last/git/myproject/project加载项目定义
[info]将当前项目设置为myproject(在构建文件中:/Users/first.last/git/myproject /)
> eclipse
[错误]不是有效的命令:eclipse(类似:help,别名)
[错误]不是有效的项目ID:eclipse
[error]预期':'(如果选择配置)
[错误]不是一个有效的密钥:eclipse(类似:交付,许可证,清理)
[错误] eclipse
[错误] ^
我正在使用sbt 0.13.5。
$ sbt --version
sbt启动器版本0.13.5
在空目录执行 sbt about
以检查build / sbt设置。
$ sbt about
[info]从/Users/jacek/.sbt/0.13/plugins加载全球插件
[info]更新{file :/Users/jacek/.sbt/0.13/plugins/}全局插件...
[info]解析org.fusesource.jansi#jansi; 1.4 ...
[info]完成更新。
[info]将当前项目设置为sbteclipse(在构建文件中:/ Users / jacek / sandbox / sbteclipse /)
[info]这是sbt 0.13.5
[info]当前项目是{file:/ Users / jacek / sandbox / sbteclipse /} sbteclipse 0.1-SNAPSHOT
[info]当前项目是针对Scala 2.10.4
构建的[info]可用的插件: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,并且构建定义正在使用Scala 2.10.4
目录中没有文件(忽略 target
,因为它在启动时由sbt自动创建,可以随时删除)。
$ tree
。
` - 目标
1目录,0文件
我然后用 sbt
运行sbt shell,以确保不存在 eclipse
命令。
$ sbt
[info]从/Users/jacek/.sbt/0.13/plugins
加载全局插件[info]将当前项目设置为sbteclipse(在构建文件中:/ Users / jacek / sandbox / sbteclipse /)
> eclipse
[错误]不是有效的命令:eclipse(类似:help,别名)
[错误]不是有效的项目ID:eclipse(类似:sbteclipse)
[error] '(如果选择一个配置)
[error]不是一个有效的密钥:eclipse(类似: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)
在文件中的插件中,我点击了 reload
sbt shell加载更改。
>重新加载$ b $ b [info]从/Users/jacek/.sbt/0.13/plugins
加载全局插件[info]更新{file:/Users/jacek/.sbt/0.13/plugins/}全局插件...
[info]解决org.fusesource.jansi#jansi; 1.4 ...
[info]完成更新。
[info]将当前项目设置为sbteclipse(在构建文件中:/ Users / jacek / sandbox / sbteclipse /)
> eclipse
[info]关于为您的项目创建Eclipse项目文件。
[info]更新{file:/ Users / jacek / sandbox / sbteclipse /} sbteclipse ...
[info]解析org.fusesource.jansi#jansi; 1.4 ...
[ info]完成更新。
[info]成功创建项目的Eclipse项目文件:
[info] sbteclipse
您可以看到插件已正确加载并生成文件。按照步骤,您应该安装插件没有问题。
I followed the official documentation to set up the plugin in my sbt project:
- Added
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")
to~/.sbt/plugins/plugins.sbt
file cd
ed to a project and ransbt
- In sbt shell, typed
eclipse
That's where I faced the following error:
> 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] ^
What am I missing?
Thanks in advance for any help you can give me.
$ /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] ^
I'm using sbt 0.13.5.
$ sbt --version
sbt launcher version 0.13.5
In an empty directory executed sbt about
to check the build/sbt setup.
$ 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
No files are in the directory (disregard target
since it's automatically created by sbt upon startup and can be removed at any time).
$ tree
.
`-- target
1 directory, 0 files
I then ran the sbt shell with sbt
to ensure no eclipse
command existed.
$ 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] ^
I could reproduce your issue. Moving on to setting up the plugin - I did not close the sbt shell.
Following the documentation closely I opened ~/.sbt/0.13/plugins/plugins.sbt
to have it as follows:
$ cat ~/.sbt/0.13/plugins/plugins.sbt
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")
With the plugin in the file, I fired reload
in the sbt shell to load the changes.
> 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
As you can see the plugin was properly loaded and generated the files. Follow the steps and you should have the plugin installed with no issues.
这篇关于如何使用sbt-eclipse创建项目的Eclipse项目文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!