2015-01-12 3 views
6

私はエラーthere were 15 feature warning(s); re-run with -feature for details得るための-featureで実行-RE:sbt 0.12.4 - x個の機能に関する警告がありました。詳細

scalaVersion := "2.10.4" 

build.sbt

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

を、私はそれはdoesnのためにそのエラーが何であるかを見つけることができませんたとえ私が$ /usr/local/sbt/bin/sbt -featureとしてsbtを実行したとしても、それは言いません。

$ /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ですか?

UPDATE

build.sbt

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

又はSBT自体で:

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

エラーが同じままです。

+1

http://stackoverflow.com/questions/9578521/scala-sbt-how-to-re-run-with-deprecation –

+0

@ SOM-snytt、それは助けにはなりませんでした。 –

+0

'-feature'が必要です。 –

答えて

6

私は日常的に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, completed Jan 12, 2015 9:45:46 AM 

ねえ、それは働きました!

2

あなたはbuild.sbtに

scalacOptions += "-feature" 

を追加し、SBTコンソールが実行されている場合、リロードを実行する(またはそれを再起動する)必要があります。

また、sbtコンソールでは、1つのセッションにのみ設定する場合は、set scalacOptions += "-feature"と書くことができます。この設定はすぐに適用されるため、sbtコンソールを再ロードする必要はありません。

Re-run with -feature for details

関連する問題