Skip to content

Commit 6cfcb75

Browse files
authored
Update play gradle plugin (#15326)
1 parent 6aac331 commit 6cfcb75

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

smoke-tests/images/play/app/controllers/HomeController.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package controllers
1818

19-
import javax.inject.Inject
19+
import jakarta.inject.Inject
2020

2121
import play.api.mvc._
2222

smoke-tests/images/play/build.gradle.kts

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.gradle.jvm.toolchain.JavaLanguageVersion
2+
import play.gradle.Language
13
import java.time.LocalDateTime
24
import 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-
1714
play {
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

2618
dependencies {
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

3833
val tag = findProperty("tag")
3934
?: DateTimeFormatter.ofPattern("yyyyMMdd.HHmmSS").format(LocalDateTime.now())
4035

4136
java {
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

4940
val repo = System.getenv("GITHUB_REPOSITORY") ?: "open-telemetry/opentelemetry-java-instrumentation"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# https://www.playframework.com/documentation/latest/Configuration
2-
play.http.secret.key=agentbenchmarktest0xCAFEDEAD
2+
play.http.secret.key=0123456789abcdeffedcba9876543210
33
http.port=8080

0 commit comments

Comments
 (0)