softwaremill / elasticmq

In-memory message queue with an Amazon SQS-compatible interface. Runs stand-alone or embedded.
https://softwaremill.com/open-source/
Apache License 2.0
2.52k stars 193 forks source link

Upgrade `sbt` so it can build against openjdk9? #128

Closed asottile closed 6 years ago

asottile commented 6 years ago

Mostly documenting the rabbit hole I'm in -- I'm unfamiliar with the build infra so sorry I'm not more help here.

Started by getting sbt on ubuntu xenial through the directions here.

Installed openjdk9 via apt update && apt install openjdk-9-jdk-headless

Went to run sbt in this project and hit this:

I was able to work around that by applying this patch:

$ git diff -- project/build.properties
diff --git a/project/build.properties b/project/build.properties
index cf19fd0..31334bb 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=0.13.15
\ No newline at end of file
+sbt.version=1.1.1

This allowed sbt to proceed but then it complained about one of the build plugins which I was able to upgrade:

$ git diff -- project/plugins.sbt
diff --git a/project/plugins.sbt b/project/plugins.sbt
index a9ac92a..ffabcb5 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,4 +1,4 @@
-addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
+addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")

 addSbtPlugin("com.gu" % "sbt-teamcity-test-reporting-plugin" % "1.5")

Then this hit the sbt-teamcity-test-reporting-plugin, which is apparently not needed any more? https://github.com/guardian/sbt-teamcity-test-reporting-plugin/issues/11

$ git diff -- project/plugins.sbt
diff --git a/project/plugins.sbt b/project/plugins.sbt
index a9ac92a..fd90413 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,5 +1,3 @@
-addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
-
-addSbtPlugin("com.gu" % "sbt-teamcity-test-reporting-plugin" % "1.5")
+addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")

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

Removing that, I then get to changed function signatures while building -- I'm just trying to get this to build or I'd jump in and fix that too (I guess I'll downgrade to openjdk8 for now?):

$ sbt
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /tmp/elasticmq/project
[info] Updating ProjectRef(uri("file:/tmp/elasticmq/project/"), "elasticmq-build")...
[info] Done updating.
[info] Compiling 1 Scala source to /tmp/elasticmq/project/target/scala-2.12/sbt-1.0/classes ...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.4. Compiling...
[info]   Compilation completed in 5.892s.
[error] /tmp/elasticmq/project/Build.scala:14:41: type mismatch;
[error]  found   : scala.collection.immutable.Set[sbt.librarymanagement.ModuleID]
[error]  required: Seq[sbt.librarymanagement.ModuleID]
[error]     dependencyOverrides := Dependencies.akka25Overrides,
[error]                                         ^
[error] /tmp/elasticmq/project/Build.scala:81:31: not found: type Build
[error] object ElasticMQBuild extends Build {
[error]                               ^
[error] /tmp/elasticmq/project/Build.scala:88:14: too many arguments (3) for method apply: (id: String, base: java.io.File)sbt.Project in object Project
[error] Note that 'settings' is not a parameter name of the invoked method.
[error]     settings = buildSettings
[error]              ^
[error] /tmp/elasticmq/project/Build.scala:94:14: too many arguments (3) for method apply: (id: String, base: java.io.File)sbt.Project in object Project
[error] Note that 'settings' is not a parameter name of the invoked method.
[error]     settings = buildSettings ++ Seq(
[error]              ^
[error] /tmp/elasticmq/project/Build.scala:102:14: too many arguments (3) for method apply: (id: String, base: java.io.File)sbt.Project in object Project
[error] Note that 'settings' is not a parameter name of the invoked method.
[error]     settings = buildSettings ++ Seq(libraryDependencies ++= Seq(jodaTime, jodaConvert, akka2Actor, akka2Testkit) ++ common)
[error]              ^
[error] /tmp/elasticmq/project/Build.scala:108:14: too many arguments (3) for method apply: (id: String, base: java.io.File)sbt.Project in object Project
[error] Note that 'settings' is not a parameter name of the invoked method.
[error]     settings = buildSettings
[error]              ^
[error] /tmp/elasticmq/project/Build.scala:114:14: too many arguments (3) for method apply: (id: String, base: java.io.File)sbt.Project in object Project
[error] Note that 'settings' is not a parameter name of the invoked method.
[error]     settings = buildSettings ++
[error]              ^
[error] /tmp/elasticmq/project/Build.scala:121:14: too many arguments (3) for method apply: (id: String, base: java.io.File)sbt.Project in object Project
[error] Note that 'settings' is not a parameter name of the invoked method.
[error]     settings = buildSettings ++ Seq(
[error]              ^
[error] /tmp/elasticmq/project/Build.scala:129:14: too many arguments (3) for method apply: (id: String, base: java.io.File)sbt.Project in object Project
[error] Note that 'settings' is not a parameter name of the invoked method.
[error]     settings = buildSettings ++ CustomTasks.generateVersionFileSettings ++ Seq(
[error]              ^
[error] /tmp/elasticmq/project/Build.scala:138:14: too many arguments (3) for method apply: (id: String, base: java.io.File)sbt.Project in object Project
[error] Note that 'settings' is not a parameter name of the invoked method.
[error]     settings = buildSettings ++ Seq(
[error]              ^
[error] 10 errors found
[error] (Compile / compileIncremental) Compilation failed
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q
adamw commented 6 years ago

I've updated the build to use the newest sbt 1.1.1 - indeed the format changed a bit since the build file was originally written :)