Tôi đang gặp một chút khó khăn khi cố tìm ra cách đặt/nối thêm scalacOptions
được SBT sử dụng khi biên dịch Build.scala
. Ai đó trong nhóm của tôi đã sao chép một đoạn mã từ số Build.scala
của Akka và kết quả là một loạt cảnh báo không được chấp nhận và cảnh báo tính năng.Làm thế nào để thiết lập scalacOptions được sử dụng bởi SBT khi biên dịch Build.scala?
$ reload
[info] Loading global plugins from /Users/xxx/.sbt/0.13/plugins
[info] Loading project definition from /Users/xxx/yyy/zzz/project
[info] Compiling 1 Scala source to /Users/xxx/yyy/zzz/project/target/scala-2.10/sbt-0.13/classes...
[warn] there were 3 deprecation warning(s); re-run with -deprecation for details
[warn] there were 1 feature warning(s); re-run with -feature for details
[warn] two warnings found
Những điều tôi đã cố gắng
- Thêm
scalacOptions ++= Seq("-unchecked", "-feature")
-build.sbt
. Tôi đã hy vọng điều này sẽ được tải trước khiBuild.scala
được biên soạn. - Đã có
scalacOptions ++= Seq(...., "-unchecked", "-feature")
trongBuild.scala
Cố gắng để thiết lập
scalacOptions
trướcreload
nhưng nó dường như bị loại bỏ$ ;set scalacOptions ++= Seq("-feature", "-deprecated") ;reload [info] Defining zzz/*:scalacOptions [info] The new value will be used by zzz/compile:scalacOptions [info] Reapplying settings... [info] Set current project to zzz (in build file:/Users/xxx/yyy/zzz/) [info] Loading global plugins from /Users/xxx/.sbt/0.13/plugins [info] Loading project definition from /Users/xxx/yyy/zzz/project [info] Compiling 1 Scala source to /Users/xxx/yyy/zzz/project/target/scala-2.10/sbt-0.13/classes... [warn] there were 3 deprecation warning(s); re-run with -deprecation for details [warn] there were 1 feature warning(s); re-run with -feature for details [warn] two warnings found [warn] Discarding 1 session setting. Use 'session save' to persist session settings.
Qua mồ hôi máu nhiều tôi đã có thể tìm ra nguyên nhân của những lời cảnh báo bị phản đối , nhưng tôi không thể tìm thấy nguyên nhân của cảnh báo tính năng.
Tôi đã có 'build.sbt' ở sai vị trí. Điều này làm việc khi tôi di chuyển 'build.sbt' từ thư mục gốc sang' project/build.sbt' – drstevens
@drstevens bạn nói đúng, nó phải nằm trong 'project/build.sbt', tôi đã cập nhật câu trả lời của mình. Nếu bạn muốn tạo 'Build.scala', bạn sẽ tạo một trong' project/project/Build.scala'. – lpiepiora