首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >sbt 0.12.4 -有x个特性警告;详细信息请与-feature一起重新运行

sbt 0.12.4 -有x个特性警告;详细信息请与-feature一起重新运行
EN

Stack Overflow用户
提问于 2015-01-12 05:24:16
回答 2查看 4K关注 0票数 15

我得到一个错误there were 15 feature warning(s); re-run with -feature for details

代码语言:javascript
复制
$ /usr/local/sbt/bin/sbt
[info] Loading project definition from /home/alex/Documents/projects/my_app123/project
[info] Set current project to sbt-android (in build file:/home/alex/Documents/projects/my_app123/)

> compile -feature
[error] Expected end of input.
[error] compile -feature
[error]        ^

> sbt-version
[info] 0.12.4

> compile 
[warn] Credentials file /home/alex/.ivy2/.credentials does not exist
[info] Compiling 20 Scala sources to /home/alex/Documents/projects/my_app123/target/scala-2.10/sbt-0.12/classes...
[error] there were 15 feature warning(s); re-run with -feature for details
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 27 s, completed 01 12, 15 1:20:12 PM

build.sbt

代码语言:javascript
复制
scalaVersion := "2.10.4"

我找不出这个错误是什么,因为它没有这么说,即使我以$ /usr/local/sbt/bin/sbt -feature的形式运行sbt。

代码语言:javascript
复制
$ /usr/local/sbt/bin/sbt -feature
[info] Loading project definition from /home/alex/Documents/projects/my_app123/project
[info] Set current project to sbt-android (in build file:/home/alex/Documents/projects/my_app123/)
$

是JDK 1.7

错误是什么?我如何修复它?

更新

build.sbt

代码语言:javascript
复制
scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation")

或在sbt本身:

> set scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation")

错误保持不变。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-01-12 17:48:51

我没有机会每天使用sbt,所以这只是为了确认链接答案中的建议:

代码语言:javascript
复制
$ sbt
[info] Set current project to Compiler options (in build file:/home/apm/tmp/sbtwarn/)
> compile
[info] Compiling 1 Scala source to /home/apm/tmp/sbtwarn/target/scala-2.11/classes...
[warn] there was one feature warning; re-run with -feature for details
[warn] one warning found
[success] Total time: 4 s, completed Jan 12, 2015 9:45:17 AM
> set scalacOptions in ThisBuild ++= Seq("-feature")
[info] Defining {.}/*:scalacOptions
[info] The new value will be used by compile:scalacOptions
[info] Reapplying settings...
[info] Set current project to Compiler options (in build file:/home/apm/tmp/sbtwarn/)
> compile
[info] Compiling 1 Scala source to /home/apm/tmp/sbtwarn/target/scala-2.11/classes...
[warn] /home/apm/tmp/sbtwarn/src/main/scala/Sample.scala:6: postfix operator head should be enabled
[warn] by making the implicit value scala.language.postfixOps visible.
[warn] This can be achieved by adding the import clause 'import scala.language.postfixOps'
[warn] or by setting the compiler option -language:postfixOps.
[warn] See the Scala docs for value scala.language.postfixOps for a discussion
[warn] why the feature should be explicitly enabled.
[warn]   Console println (List(1,2,3) head)
[warn]                                ^
[warn] one warning found
[success] Total time: 1 s, completed Jan 12, 2015 9:45:46 AM

嘿,成功了!

票数 10
EN

Stack Overflow用户

发布于 2017-06-28 05:17:22

你应该加上

代码语言:javascript
复制
scalacOptions += "-feature"

如果您的sbt控制台正在运行(或重新启动),则执行build.sbt。

或者,如果您只想为单个会话设置它,而在sbt控制台中,您可以编写set scalacOptions += "-feature",此设置将立即应用,不需要重新加载或重新启动sbt控制台。

Re-run with -feature for details

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27895790

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档