[play-reactivemongo] sbt publish-local suport for Scala 2.12

139 views
Skip to first unread message

Fábio Pinheiro

unread,
May 8, 2017, 5:57:58 PM5/8/17
to ReactiveMongo - http://reactivemongo.org
Today the "Update to Scala 2.12 #226" was pull to master.
I have some questions about how to build the project for Scala 2.12 and play 2.6.0-M5, from the master branch.
If I do "sbt publish-local" it will only publish "play2-reactivemongo_2.11"

By the away in Play2-ReactiveMongo.scala you have the key crossScalaVersions two-time:
crossScalaVersions := Seq("2.11.8", "2.12.1")
crossScalaVersions := Seq(scalaVersion.value) //scalaVersion := "2.11.8"

I was trying to imitate travis-ci by:
"export PLAY_VERSION=2.6.0-M5"

diff --git a/project/Play2-ReactiveMongo.scala b/project/Play2-ReactiveMongo.scala
index 35d7513..f3098fd 100644
--- a/project/Play2-ReactiveMongo.scala
+++ b/project/Play2-ReactiveMongo.scala
@@ -4,7 +4,7 @@ import sbt.Keys._
object BuildSettings {
  val buildSettings = Defaults.defaultSettings ++ Seq(
    organization := "org.reactivemongo",
-    scalaVersion := "2.11.8",
+    scalaVersion := "2.12.1",
    crossScalaVersions := Seq("2.11.8", "2.12.1"),
    scalacOptions ++= Seq("-unchecked", "-deprecation", "-target:jvm-1.8"),
    scalacOptions in Compile ++= Seq(


But I got 2 errors.
Any ideas on how to resolve?



➜  play-reactivemongo git:(master) ✗ sbt publish-local
[info] Loading project definition from /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/project
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
[info] Set current project to Play2-ReactiveMongo (in build file:/home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/)
[info] Packaging /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/target/scala-2.12/play2-reactivemongo_2.12-0.12.4-SNAPSHOT-sources.jar ...
[info] Updating {file:/home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/}Play2-ReactiveMongo...
[info] Formatting 12 Scala sources {file:/home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/}Play2-ReactiveMongo(compile) ...
[info] Done packaging.
[info] Resolving org.reactivemongo#reactivemongo_2.12;0.12.4-SNAPSHOT ...
[warn] Unable to reparse org.reactivemongo#reactivemongo_2.12;0.12.4-SNAPSHOT from Sonatype snapshots, using Mon May 08 13:13:57 WEST 2017
[warn] Choosing Sonatype snapshots for org.reactivemongo#reactivemongo_2.12;0.12.4-SNAPSHOT
[info] Resolving org.reactivemongo#reactivemongo-bson-macros_2.12;0.12.4-SNAPSHOT ...
[warn] Unable to reparse org.reactivemongo#reactivemongo-bson-macros_2.12;0.12.4-SNAPSHOT from Sonatype snapshots, using Mon May 08 13:13:22 WEST 2017
[warn] Choosing Sonatype snapshots for org.reactivemongo#reactivemongo-bson-macros_2.12;0.12.4-SNAPSHOT
[info] Resolving org.reactivemongo#reactivemongo-bson_2.12;0.12.4-SNAPSHOT ...
[warn] Unable to reparse org.reactivemongo#reactivemongo-bson_2.12;0.12.4-SNAPSHOT from Sonatype snapshots, using Mon May 08 13:13:02 WEST 2017
[warn] Choosing Sonatype snapshots for org.reactivemongo#reactivemongo-bson_2.12;0.12.4-SNAPSHOT
[info] Resolving org.reactivemongo#reactivemongo-shaded;0.12.4-SNAPSHOT ...
[warn] Unable to reparse org.reactivemongo#reactivemongo-shaded;0.12.4-SNAPSHOT from Sonatype snapshots, using Mon May 08 13:12:30 WEST 2017
[warn] Choosing Sonatype snapshots for org.reactivemongo#reactivemongo-shaded;0.12.4-SNAPSHOT
[info] Resolving org.reactivemongo#reactivemongo-play-json_2.12;0.12.4-SNAPSHOT ...
[warn] Unable to reparse org.reactivemongo#reactivemongo-play-json_2.12;0.12.4-SNAPSHOT from Sonatype snapshots, using Mon May 08 15:24:42 WEST 2017
[warn] Choosing Sonatype snapshots for org.reactivemongo#reactivemongo-play-json_2.12;0.12.4-SNAPSHOT
[info] Resolving com.google.code.findbugs#jsr305;3.0.0 ...
[info] Done updating.
[warn] Skipped generating '<exclusion/>' for com.typesafe.akka#*. Dependency exclusion should have both 'org' and 'module' to comply with Maven POM's schema.
[warn] Skipped generating '<exclusion/>' for com.typesafe.play#*. Dependency exclusion should have both 'org' and 'module' to comply with Maven POM's schema.
[info] Wrote /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/target/scala-2.12/play2-reactivemongo_2.12-0.12.4-SNAPSHOT.pom
[info] :: delivering :: org.reactivemongo#play2-reactivemongo_2.12;0.12.4-SNAPSHOT :: 0.12.4-SNAPSHOT :: integration :: Mon May 08 22:52:14 WEST 2017
[info]  delivering ivy file to /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/target/scala-2.12/ivy-0.12.4-SNAPSHOT.xml
[info] Main Scala API documentation to /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/target/scala-2.12/api...
[info] Compiling 13 Scala sources and 2 Java sources to /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/target/scala-2.12/classes...
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/NamedDatabase.java:9: Implementation restriction: subclassing Classfile does not
[warn] make your annotation visible at runtime.  If that is what
[warn] you want, you must write the annotation class in Java.
[warn] public @interface NamedDatabase {
[warn]                   ^
[error] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/NamedDatabaseImpl.java:7: class NamedDatabase needs to be a trait to be mixed in
[error] public class NamedDatabaseImpl implements NamedDatabase, Serializable {
[error]                                           ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/NamedDatabaseImpl.java:7: Implementation restriction: subclassing Classfile does not
[warn] make your annotation visible at runtime.  If that is what
[warn] you want, you must write the annotation class in Java.
[warn] public class NamedDatabaseImpl implements NamedDatabase, Serializable {
[warn]              ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/ReactiveMongoModule.scala:50: private setter in class ReactiveMongoProvider is never used
[warn]   @Inject private var applicationLifecycle: ApplicationLifecycle = _
[warn]                       ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/ReactiveMongoModule.scala:50: private setter in class ReactiveMongoProvider is never used
[warn]   @Inject private var applicationLifecycle: ApplicationLifecycle = _
[warn]                       ^
[info] No documentation generated with unsuccessful compiler run
[warn] three warnings found
[error] one error found
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:68: constructor MongoDriver in class MongoDriver is deprecated (since 0.12-RC6): Use the constructor with the classloader
[warn]   lazy val driver = new MongoDriver(Some(configuration.underlying))
[warn]                     ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:89: object Execution in package concurrent is deprecated (since 2.6.0): Please see https://www.playframework.com/documentation/2.6.x/Migration26#Execution
[warn]     connection.database(dbName)
[warn]                        ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:127: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]     val db = configuration.getString("mongodb.db").getOrElse(
[warn]                            ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:133: method getStringList in class Configuration is deprecated (since 2.6.0): Use underlying.getStringList with reference config entry
[warn]     val uris = configuration.getStringList("mongodb.servers") match {
[warn]                              ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:134: object JavaConversions in package collection is deprecated (since 2.12.0): use JavaConverters
[warn]       case Some(list) => scala.collection.JavaConversions.
[warn]                                           ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:164: method getInt in class Configuration is deprecated (since 2.6.0): Use get[Int] with reference config entry
[warn]     configuration.getInt("mongodb.options.nbChannelsPerNode").
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:167: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]     configuration.getString("mongodb.options.authSource").
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:170: method getInt in class Configuration is deprecated (since 2.6.0): Use get[Int] with reference config entry
[warn]     configuration.getInt("mongodb.options.connectTimeoutMS").
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:173: method getBoolean in class Configuration is deprecated (since 2.6.0): Use get[Boolean] with reference config entry
[warn]     configuration.getBoolean("mongodb.options.tcpNoDelay").
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:176: method getBoolean in class Configuration is deprecated (since 2.6.0): Use get[Boolean] with reference config entry
[warn]     configuration.getBoolean("mongodb.options.keepAlive").
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:179: method getBoolean in class Configuration is deprecated (since 2.6.0): Use get[Boolean] with reference config entry
[warn]     configuration.getBoolean("mongodb.options.ssl.enabled").
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:182: method getBoolean in class Configuration is deprecated (since 2.6.0): Use get[Boolean] with reference config entry
[warn]     configuration.getBoolean("mongodb.options.ssl.allowsInvalidCert").
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:185: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]     configuration.getString("mongodb.options.authMode").foreach {
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:192: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]     configuration.getString("mongodb.options.writeConcern").foreach {
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:210: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]     configuration.getString("mongodb.options.writeConcernW").foreach {
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:222: method getBoolean in class Configuration is deprecated (since 2.6.0): Use get[Boolean] with reference config entry
[warn]     configuration.getBoolean("mongodb.options.writeConcernJ").foreach { jed =>
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:226: method getInt in class Configuration is deprecated (since 2.6.0): Use get[Int] with reference config entry
[warn]     configuration.getInt("mongodb.options.writeConcernTimeout").foreach { ms =>
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:232: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]     configuration.getString("mongodb.options.readPreference").foreach {
[warn]                   ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:252: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]       username <- configuration.getString("mongodb.credentials.username")
[warn]                                 ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:253: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]       password <- configuration.getString("mongodb.credentials.password")
[warn]                                 ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:286: method getConfig in class Configuration is deprecated (since 2.6.0): Use get[Configuration] with reference config entry
[warn]   private[reactivemongo] def parseConfiguration(configuration: Configuration): Seq[(String, BindingInfo)] = configuration.getConfig("mongodb") match {
[warn]                                                                                                                           ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:290: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]       subConf.getString("uri").map("mongodb.uri" -> _).
[warn]               ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:291: method getString in class Configuration is deprecated (since 2.6.0): Use get[String] or getAndValidate[String] with reference config entry
[warn]         orElse(subConf.getString("default.uri").
[warn]                        ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:297: method getBoolean in class Configuration is deprecated (since 2.6.0): Use get[Boolean] with reference config entry
[warn]                 strict = configuration.getBoolean(strictKey).getOrElse(false),
[warn]                                        ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/DefaultReactiveMongoApi.scala:318: method getBoolean in class Configuration is deprecated (since 2.6.0): Use get[Boolean] with reference config entry
[warn]               strict = configuration.getBoolean(strictKey).getOrElse(false),
[warn]                                      ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/MongoController.scala:118: trait Controller in package mvc is deprecated (since 2.6.0): Your controller should extend AbstractController, BaseController, or InjectedController instead.
[warn] trait MongoController extends Controller { self: ReactiveMongoComponents =>
[warn]                               ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/MongoController.scala:193: lazy value parse in trait BodyParsers is deprecated (since 2.6.0): Inject PlayBodyParsers or use AbstractController instead
[warn]     parse.multipartFormData {
[warn]     ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/MongoController.scala:196: method iteratee in class GridFS is deprecated (since 0.12.0): Use [[iterateeWithMD5]]
[warn]           val gfsIt = gridFS.iteratee(fileToSave(filename, contentType))
[warn]                              ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/PathBindables.scala:83: method apply in object BSONObjectID is deprecated (since 0.12.0): `parse(str: String): Try[BSONObjectID]` should be considered instead of this method
[warn]       b.bind(key, value).right.flatMap { str => unsafe(BSONObjectID(str)) }
[warn]                                                        ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/json.scala:28: trait ImplicitBSONHandlers in package json is deprecated (since 0.11.9): Use [[reactivemongo.play.json.BSONFormats]]
[warn] object `package` extends ImplicitBSONHandlers {
[warn]                          ^
[warn] /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/src/main/scala/play/modules/reactivemongo/jsoncommands.scala:66: class DefaultJSONCommandError in package commands is deprecated (since 0.12.0): Use [[reactivemongo.play.json.commands.DefaultJSONCommandError]]
[warn]         JsError(new DefaultJSONCommandError(
[warn]                     ^
[warn] there was one feature warning; re-run with -feature for details
[warn] 33 warnings found
[info] Packaging /home/fabio/.sbt/0.13/staging/9de464c59ccceeaffbba/play-reactivemongo/target/scala-2.12/play2-reactivemongo_2.12-0.12.4-SNAPSHOT.jar ...
[info] Done packaging.
[error] (compile:doc) Scaladoc generation failed
[error] Total time: 38 s, completed May 8, 2017 10:52:37 PM

Fábio Pinheiro

unread,
May 8, 2017, 6:22:56 PM5/8/17
to ReactiveMongo - http://reactivemongo.org
I found a quick a workaround in http://www.scala-lang.org/news/2.12.0
Can someone please tell me what should we do to fix this problem for others in the future?
Should I open one Issue and start a branch (pull request)?
What is the correct way to fix this?

"""

SCALADOC CAN BE USED TO DOCUMENT JAVA SOURCES

This fix for SI-4826 simplifies generating comprehensive documentation for projects with both Scala and Java sources. Thank you for your contribution, Jakob Odersky!

This feature is enabled by default, but can be disabled with:

  1. scalacOptions in (Compile, doc) += "-no-java-comments"

Some projects with very large Javadoc comments may run into a stack overflow in the Javadoc scanner, which will be fixed in 2.12.1.

"""


diff --git a/project/Play2-ReactiveMongo.scala b/project/Play2-ReactiveMongo.scala
index 35d7513..b96a8c3 100644
--- a/project/Play2-ReactiveMongo.scala
+++ b/project/Play2-ReactiveMongo.scala
@@ -4,7 +4,7 @@ import sbt.Keys._
object BuildSettings {
  val buildSettings = Defaults.defaultSettings ++ Seq(
    organization := "org.reactivemongo",
-    scalaVersion := "2.11.8",
+    scalaVersion := "2.12.1",
    crossScalaVersions := Seq("2.11.8", "2.12.1"),
    scalacOptions ++= Seq("-unchecked", "-deprecation", "-target:jvm-1.8"),
    scalacOptions in Compile ++= Seq(
@@ -12,7 +12,7 @@ object BuildSettings {
      "-Ywarn-unused-import", "-Ywarn-value-discard", "-Ywarn-dead-code",
      "-Ywarn-unused", "-Xlint:missing-interpolator"),
    scalacOptions in (Compile, doc) ++= Seq("-unchecked", "-deprecation",
-      /*"-diagrams", */"-implicits", "-skip-packages", "samples") ++
+      /*"-diagrams", */"-implicits", "-skip-packages", "samples", "-no-java-comments") ++
      Opts.doc.title("ReactiveMongo Play plugin") ++
      Opts.doc.version(Release.major.value),
    crossScalaVersions := Seq(scalaVersion.value),
(END)

Reply all
Reply to author
Forward
0 new messages