加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

scala – sbt 0.12.4 – 有x特征警告;重新运行-feature以获取详

发布时间:2020-12-16 19:19:44 所属栏目:安全 来源:网络整理
导读:我收到一个错误,有15个功能警告;使用-feature重新运行以获取详细信息: $/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/
我收到一个错误,有15个功能警告;使用-feature重新运行以获取详细信息:

$/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中

scalaVersion := "2.10.4"

我无法找出那个错误是什么,因为它没有说,即使我运行sbt为$/usr/local / sbt / bin / sbt -feature.

$/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

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

或者在sbt本身:

>在ThisBuild中设置scalacOptions = Seq(“ – unchecked”,“ – deprecation”)

错误保持不变.

解决方法

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

$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,2015 9:45:46 AM

嘿,它奏效了!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读