¿Por qué `scalaVersion in Global` no configura scalaVersion para todos los proyectos?
Frecuentes
Visto 240 equipos
0
Despues de leer Scopes documentation, I expected
scalaVersion in Global := "2.10.3"
in object MyProjectBuild extends Build
para establecer scalaVersion
for all projects. However, after reloading the project, I get
> show scalaVersion
[info] subproject1/*:scalaVersion
[info] 2.10.2
[info] subproject2/*:scalaVersion
[info] 2.10.2
[info] all/*:scalaVersion
[info] 2.10.2
Lo mismo pasa con ThisBuild
en lugar de Global
. scalaVersion
isn't set anywhere else. What am I misunderstanding? inspect
produces (both for Global
y ThisBuild
):
> inspect scalaVersion
[info] Setting: java.lang.String = 2.10.2
[info] Description:
[info] The version of Scala used for building.
[info] Provided by:
[info] */*:scalaVersion
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:211
[info] Reverse dependencies:
[info] all/*:ivyReport::update
[info] all/*:dependencyUpdatesData
[info] all/*:scalaInstance
[info] all/*:update
[info] all/*:allDependencies
[info] all/*:libraryDependencies
[info] Delegates:
[info] all/*:scalaVersion
[info] {.}/*:scalaVersion
[info] */*:scalaVersion
[info] Related:
[info] */*:scalaVersion
> inspect actual scalaVersion
[info] Setting: java.lang.String = 2.10.2
[info] Description:
[info] The version of Scala used for building.
[info] Provided by:
[info] */*:scalaVersion
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:211
[info] Delegates:
[info] all/*:scalaVersion
[info] {.}/*:scalaVersion
[info] */*:scalaVersion
[info] Related:
[info] */*:scalaVersion
I currently set common settings for all projects using a val commonSettings = Seq(scalaVersion := ...)
y settings(commonSettings: _*)
for all projects, so the question is specifically why doesn't the above approach work.
2 Respuestas
0
My guess is you're using the Play Framework or some other framework that adds its own keys to the build, and you're setting the scala version before adding the framework keys.
Mueva el scalaVersion
definition to the bottom of the build script, you should get what you want (or, alternatively, move the playScalaSettings
or whatever else above the definition)
Respondido 12 Feb 14, 08:02
No, I am not using any such framework. I was setting scalaVersion
temprano en Build.scala
, but moving scalaVersion
to the bottom doesn't change anything. - Aleksey Romanov
0
The project was using SBT 0.13.0. After switching to 0.13.1 it works as expected, though I don't see anything relevant in the cambios.
Respondido 12 Feb 14, 12:02
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas scala sbt or haz tu propia pregunta.
Has probado
inspect scalaVersion
yinspect actual scalaVersion
for hints on where it is getting the value from? - huynhjl@huynhjl Added the output. - Alexey Romanov