Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't pass on akka-http as an explicit-runtime dep
The Play framework is very particular about the versions of Akka and Akka HTTP that it uses: https://www.playframework.com/documentation/2.8.x/ScalaAkka#Updating-Akka-version Unless you're directly using Akka HTTP, it's best to avoid explicitly adding Akka HTTP as a dependency (even a transitive one) on a Play project, because it's quite likely you'll choose a different version to Play, and mixed versions are not allowed: https://doc.akka.io/docs/akka/2.6/common/binary-compatibility-rules.html#mixed-versioning-is-not-allowed In the case of #79, which added `akka-http` as a runtime dependency of `play-googleauth`, the dependency caused `ClassNotFoundException`s at runtime in the Ophan project when we upgraded to the latest version of `play-googleauth`: ``` [error] Caused by: java.lang.ClassNotFoundException: akka.http.javadsl.UseHttp2 [error] at java.net.URLClassLoader.findClass(URLClassLoader.java:382) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [error] at play.core.server.AkkaHttpServerProvider.createServer(AkkaHttpServer.scala:647) [error] at play.core.server.AkkaHttpServerProvider.createServer(AkkaHttpServer.scala:645) [error] at play.core.server.DevServerStart$.$anonfun$mainDev$1(DevServerStart.scala:268) ``` Note that PR #79 mentions that the `akka-http` dependency is only needed to make the tests compile: 25a86c6 ...this gives us an easy fix - only add `akka-http` as a dependency for the *tests*, _not_ the main code - ie make it a test-scoped dependency, by adding `% Test` on the end: https://www.scala-sbt.org/1.x/docs/Library-Dependencies.html#Per-configuration+dependencies Now projects _using_ `play-googleauth` won't have any version of `akka-http` transitively included for them, but the tests will still compile. I've also lowered the version of `akka-http` used within the tests to make it a little more realistic, to a version that's apparently what real versions of Play actually are using: https://github.com/playframework/playframework/blob/2.8.5/project/Dependencies.scala#L11 https://github.com/playframework/playframework/blob/2.7.7/project/Dependencies.scala#L11 ...but that's just a nod to realism in the tests, it doesn't have to be completely accurate there!
- Loading branch information