question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

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

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

From LagomPlugin.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.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
NicolasRouquettecommented, Oct 1, 2020

@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.

1reaction
steinybotcommented, Jul 2, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

maven - warning:Multiple versions of scala libraries detected?
They hardcode a specific Scala version, and you'll have to look in their ... by requiring a common parent POM for all your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found