1+ import org.gradle.jvm.toolchain.JavaLanguageVersion
2+ import play.gradle.Language
13import java.time.LocalDateTime
24import java.time.format.DateTimeFormatter
35
@@ -6,44 +8,33 @@ plugins {
68 id(" otel.spotless-conventions" )
79
810 id(" com.google.cloud.tools.jib" )
9- // TODO (trask) this plugin doesn't support Play 2.9+, see https://github.com/gradle/playframework/issues/185
10- // once play 3.1 is released, we can update to https://github.com/orgs/playframework/discussions/12338
11- id(" org.gradle.playframework" ) version " 0.16.0"
11+ id(" org.playframework.play" ) version " 3.1.0-M4"
1212}
1313
14- val playVer = " 2.8.22"
15- val scalaVer = " 2.12"
16-
1714play {
18- platform {
19- playVersion.set(playVer)
20- scalaVersion.set(scalaVer)
21- javaVersion.set(JavaVersion .VERSION_1_8 )
22- }
23- injectedRoutesGenerator.set(true )
15+ lang.set(Language .SCALA )
2416}
2517
2618dependencies {
27- implementation(" com.typesafe.play:play-guice_$scalaVer :$playVer " )
28- // Guice 5.1 is needed for Java 17 support on Play 2.8, see https://github.com/playframework/playframework/releases/tag/2.8.15
29- // TODO (trask) remove these version overrides after updating to Play 2.9
30- implementation(" com.google.inject:guice:5.1.0" )
31- implementation(" com.google.inject.extensions:guice-assistedinject:5.1.0" )
32- implementation(" com.typesafe.play:play-logback_$scalaVer :$playVer " )
33- implementation(" com.typesafe.play:filters-helpers_$scalaVer :$playVer " )
19+ val playVersion = " 3.1.0-M4"
20+ val scalaVersion = " 2.13"
21+
22+ implementation(" org.playframework:play-guice_$scalaVersion :$playVersion " )
23+ implementation(" org.playframework:play-logback_$scalaVersion :$playVersion " )
24+ implementation(" org.playframework:play-filters-helpers_$scalaVersion :$playVersion " )
25+ runtimeOnly(" org.playframework:play-server_$scalaVersion :$playVersion " )
26+ runtimeOnly(" org.playframework:play-pekko-http-server_$scalaVersion :$playVersion " )
27+ runtimeOnly(" org.apache.pekko:pekko-http_$scalaVersion :1.3.0" )
3428}
3529
36- val targetJDK = project.findProperty(" targetJDK" ) ? : " 11"
30+ val targetJDK = (project.findProperty(" targetJDK" ) as String? ) ? : " 17"
31+ val javaLanguageVersion = targetJDK.toIntOrNull() ? : 17
3732
3833val tag = findProperty(" tag" )
3934 ? : DateTimeFormatter .ofPattern(" yyyyMMdd.HHmmSS" ).format(LocalDateTime .now())
4035
4136java {
42- // this is needed to avoid jib failing with
43- // "Your project is using Java 17 but the base image is for Java 8"
44- // (it seems the jib plugins does not understand toolchains yet)
45- sourceCompatibility = JavaVersion .VERSION_1_8
46- targetCompatibility = JavaVersion .VERSION_1_8
37+ toolchain.languageVersion.set(JavaLanguageVersion .of(javaLanguageVersion))
4738}
4839
4940val repo = System .getenv(" GITHUB_REPOSITORY" ) ? : " open-telemetry/opentelemetry-java-instrumentation"
0 commit comments