Lagom: scalaVersion of lagom-internal-meta-* projects is hard coded to 2.11.7

Created on 1 Aug 2017  路  8Comments  路  Source: lagom/lagom

Lagom Version - 1.3.6

This is an issue with the Lagom SBT plugin

API : SBT/Scala

Operating System (Centos 7)

uname -a
Linux sherpavm 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

JDK (Oracle 1.8.0_112, OpenJDK 1.8.x, Azul Zing)

java -version
openjdk version "1.8.0_77"
OpenJDK Runtime Environment (build 1.8.0_77-b03)
OpenJDK 64-Bit Server VM (build 25.77-b03, mixed mode)

Library Dependencies

This is an issue when using ensime. The ensime plugin only supports a single version of scala for a project and it's dependencies. Since the internal-meta projects are dynamic, it doesn't look like you can change the scalaVersion setting in your build.sbt. Adding ensimeIgnoreScalaMismatch in ThisBuild := true interacts very badly with the dynamic projects. Enumerating the projects that you want ensime to use on the ensimeConfig command line, without listing the dynamic projects is a workaround, but quite cumbersome.

I'll be happy to submit a PR if we can agree that this should be addressed, and where to get the scalaVersion for the dynamic projects.

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. scalaVersion in ThisBuild := "2.11.8"
  2. show scalaVersion - should displays 2.11.8 for all projects defined in build.sbt
  3. show show lagom-internal-meta-project-cassandra/scalaVersion - should display 2.11.8

Actual Behavior

Please provide a description of what actually happens, working from the same starting point.

Be descriptive: "it doesn't work" does not describe what the behavior actually is -- instead, say "the page renders a 500 error code with no body content." Copy and paste logs, and include any URLs.

  1. scalaVersion in ThisBuild := "2.11.8"
  2. show scalaVersion - should displays 2.11.8 for all projects defined in build.sbt

    show scalaVersion
    [info] itemImpl/:scalaVersion
    [info] 2.11.8
    [info] searchImpl/
    :scalaVersion
    [info] 2.11.8
    [info] searchApi/:scalaVersion
    [info] 2.11.8
    [info] userApi/
    :scalaVersion
    [info] 2.11.8
    [info] biddingImpl/:scalaVersion
    [info] 2.11.8
    [info] webGateway/
    :scalaVersion
    [info] 2.11.8
    [info] biddingApi/:scalaVersion
    [info] 2.11.8
    [info] itemApi/
    :scalaVersion
    [info] 2.11.8
    [info] userImpl/:scalaVersion
    [info] 2.11.8
    [info] root/
    :scalaVersion
    [info] 2.11.8

  3. show show lagom-internal-meta-project-cassandra/scalaVersion

    show lagom-internal-meta-project-cassandra/scalaVersion
    [info] 2.11.7

From LagomPlugin.scala:
``scala private val kafkaServerProject = Project("lagom-internal-meta-project-kafka", file("."), configurations = Configurations.default, settings = CorePlugin.projectSettings ++ IvyPlugin.projectSettings ++ JvmPlugin.projectSettings ++ Seq( scalaVersion := "2.11.7", libraryDependencies += LagomImport.component("lagom-kafka-server"), lagomKafkaStart in ThisBuild := startKafkaServerTask.value, lagomKafkaStop in ThisBuild := Servers.KafkaServer.tryStop(new SbtLoggerProxy(state.value.log)) ))

Reproducible Test Case

An unchanged https://github.com/lagom/online-auction-scala demonstrates this. I believe that any lagom project can reproduce, given the hard-coded version numbers in LagomPlugin.scala.

help wanted dev-environment improvement

All 8 comments

It sounds to me like a good thing to fix. I'm not sure why it's hardcoded. Thanks for the detailed notes, @dpennell. A pull request would be a great help.

Now I also have this problem, why haven't fixed it.

@BornToRain it wasn't fixed because there are so many other things that have higher priority.

We labelled it as help:community which means that we believe it's something that should be done, but that we expect the interested parts to jump into it.

Please, feel free to send a PR if that's something that will help you move forward.

@renatocaval I have raised a PR that should fix this

This is a big problem when adding an sbt plugin which adds compiler plugins which require a specific Scala version (e.g. silencer), especially considered that due to https://github.com/sbt/sbt/issues/5661 it is not possible to override the Scala version of the extra projects.

Does it need to be set at? Can it not delegate to the build setting? Assuming that works for extra projects.

@steinybot The combination of using the silencer & Lagom results in a very nasty situation indeed!

I could not import my project in Intellij via sbt or bloop after updating to Lagom 1.6.4.

The problem comes from this in build.sbt:

// https://github.com/ghik/silencer/releases
// https://search.maven.org/artifact/com.github.ghik/silencer-lib_2.13.3
val silencerVersion = "1.7.1"

libraryDependencies in ThisBuild ++= Seq(
  compilerPlugin("com.github.ghik" % "silencer-plugin" % silencerVersion cross CrossVersion.full),
  "com.github.ghik" % "silencer-lib" % silencerVersion % Provided cross CrossVersion.full
)

Since the Lagom 1.6.4 plugin hardcodes scala 2.12.10 for the meta projects and since there is no version of the silencer plugin for that version of Scala, sbt failed.

The workaround is to add the silencer plugin explicitly in the projects that need it.

That's good enough for now but this bug definitely needs to be fixed.

I have the same problem as @NicolasRouquette

Luckily Scala 2.12.13 has just been released, which means we don't need to include the silencer plugin anymore (https://github.com/scala/scala/pull/9248). So that specific issue is resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lapidus79 picture lapidus79  路  3Comments

jroper picture jroper  路  3Comments

ignasi35 picture ignasi35  路  6Comments

idoshamun picture idoshamun  路  6Comments

ignasi35 picture ignasi35  路  4Comments