eclipse 安装 sbteclipse
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12983900/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing sbteclipse
提问by Maik Klein
i have problems top use sbteclipse
我在使用sbteclipse 时遇到问题
What I have done:
我做了什么:
- went to my global sbt folder.
- created a plugins folder
- created the file plugins.sbt with
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
- went to my eclipse project and created a build.sbt file
- it contains:
- 去了我的全局 sbt 文件夹。
- 创建了一个插件文件夹
- 创建文件 plugins.sbt
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
- 转到我的 eclipse 项目并创建了一个 build.sbt 文件
- 它包含了:
name := "foo"
version := "1.0" scalaVersion := "2.9.2" libraryDependencies += "net.java.dev.jna" % "jna" % "3.4.0"
名称 := "foo"
version := "1.0" scalaVersion := "2.9.2" libraryDependencies += "net.java.dev.jna" % "jna" % "3.4.0"
- I am selecting the project folder in my cmd. and type
sbt eclipse
- 我在我的 cmd 中选择项目文件夹。并输入
sbt eclipse
But I always get the following error
但我总是收到以下错误
[error] Not a valid command: eclipse (similar: help, alias)
[error] Not a valid project ID: eclipse
[error] Expected ':'
[error] Not a valid key: eclipse (similar: deliver, licenses, clean)
[error] eclipse
[error] ^
ps: I am using Windows. I am also using sbt 0.12
ps:我使用的是Windows。我也在使用 sbt 0.12
采纳答案by Ivan Meredith
Your global sbt folder is at %USERPROFILE%\.sbt
(C:\Users\<username>\.sbt
most likely). So your plugins should be defined at %USERPROFILE%\.sbt\plugins\plugins.sbt
您的全局 sbt 文件夹位于%USERPROFILE%\.sbt
(C:\Users\<username>\.sbt
很可能)。所以你的插件应该定义在%USERPROFILE%\.sbt\plugins\plugins.sbt
Failing this you can add it to your project directly. Add the file path is <project_root>\project\plugins.sbt
. If the project
directory doesn't exist you will need to create it.
如果失败,您可以直接将其添加到您的项目中。添加文件路径为<project_root>\project\plugins.sbt
. 如果该project
目录不存在,您将需要创建它。
回答by okello
I think that I might have found a solution. First, the default directory checked for plugins configuration is 'USER_HOME/.sbt/plugins' and NOT 'USER_HOME/.sbt/0.13/plugins'.
我想我可能已经找到了解决方案。首先,检查插件配置的默认目录是“USER_HOME/.sbt/plugins”而不是“USER_HOME/.sbt/0.13/plugins”。
Secondly, the sbt version specified seems to matter. In 'PROJECT_HOME/project/build.properties', there's an 'sbt.version' property. If the version of sbt specified in this file is different from the actually installed version of sbt, there's likely to be an issue. I think I was affected more so by this because I'm using an Activator template and it already had 'sbt.version' specified in this 'build.properties' file.
其次,指定的 sbt 版本似乎很重要。在“PROJECT_HOME/project/build.properties”中,有一个“sbt.version”属性。如果此文件中指定的 sbt 版本与实际安装的 sbt 版本不同,则可能存在问题。我想我受到的影响更大,因为我使用的是 Activator 模板,并且它已经在这个“build.properties”文件中指定了“sbt.version”。
While nosing around, I came across this
在四处闲逛时,我遇到了这个
"Support for plugin configuration in project/plugins/ has been removed. It was deprecated since 0.11.2" from sbt website at http://www.scala-sbt.org/0.13.0/docs/Community/ChangeSummary_0.13.0.html. I still see a lot of guys pointing that it should be configured in 'PROJECT_HOME/projects/plugins.sbt'. I think this is very confusing.
来自 sbt 网站http://www.scala-sbt.org/0.13.0/docs/Community/ChangeSummary_0.13.0 的“对 project/plugins/ 中插件配置的支持已被删除。自 0.11.2 起已弃用” 。 html. 我仍然看到很多人指出它应该在“PROJECT_HOME/projects/plugins.sbt”中进行配置。我认为这是非常令人困惑的。