diff --git a/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml b/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml
index 72e0a03b2..bb50d025c 100644
--- a/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml
+++ b/examples/example-exemplars-tail-sampling/example-greeting-service/pom.xml
@@ -19,7 +19,7 @@
- 17
+ 25
diff --git a/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml b/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml
index 119365d21..8340eff32 100644
--- a/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml
+++ b/examples/example-exemplars-tail-sampling/example-hello-world-app/pom.xml
@@ -19,7 +19,7 @@
- 17
+ 25
diff --git a/examples/example-exporter-servlet-tomcat/pom.xml b/examples/example-exporter-servlet-tomcat/pom.xml
index 22cd66d08..218eebe09 100644
--- a/examples/example-exporter-servlet-tomcat/pom.xml
+++ b/examples/example-exporter-servlet-tomcat/pom.xml
@@ -17,7 +17,7 @@
- 17
+ 25
diff --git a/integration-tests/it-common/src/test/java/io/prometheus/client/it/common/ExporterTest.java b/integration-tests/it-common/src/test/java/io/prometheus/client/it/common/ExporterTest.java
index 456bd306b..cb61bffb4 100644
--- a/integration-tests/it-common/src/test/java/io/prometheus/client/it/common/ExporterTest.java
+++ b/integration-tests/it-common/src/test/java/io/prometheus/client/it/common/ExporterTest.java
@@ -9,8 +9,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
+import java.net.URI;
import java.net.URISyntaxException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -34,7 +34,7 @@ public ExporterTest(String sampleApp) throws IOException, URISyntaxException {
Volume.create("it-exporter")
.copy("../../it-" + sampleApp + "/target/" + sampleApp + ".jar");
this.sampleAppContainer =
- new GenericContainer<>("openjdk:17")
+ new GenericContainer<>("openjdk:25")
.withFileSystemBind(sampleAppVolume.getHostPath(), "/app", BindMode.READ_ONLY)
.withWorkingDirectory("/app")
.withLogConsumer(LogConsumer.withPrefix(sampleApp))
@@ -68,7 +68,7 @@ protected Response scrape(String method, String queryString, String... requestHe
throws IOException {
return scrape(
method,
- new URL(
+ URI.create(
"http://localhost:"
+ sampleAppContainer.getMappedPort(9400)
+ "/metrics?"
@@ -76,10 +76,10 @@ protected Response scrape(String method, String queryString, String... requestHe
requestHeaders);
}
- public static Response scrape(String method, URL url, String... requestHeaders)
+ public static Response scrape(String method, URI uri, String... requestHeaders)
throws IOException {
long timeoutMillis = TimeUnit.SECONDS.toMillis(5);
- HttpURLConnection con = (HttpURLConnection) url.openConnection();
+ HttpURLConnection con = (HttpURLConnection) uri.toURL().openConnection();
con.setRequestMethod(method);
for (int i = 0; i < requestHeaders.length; i += 2) {
con.setRequestProperty(requestHeaders[i], requestHeaders[i + 1]);
@@ -111,7 +111,7 @@ public static Response scrape(String method, URL url, String... requestHeaders)
if (exception != null) {
exception.printStackTrace();
}
- fail("timeout while getting metrics from " + url);
+ fail("timeout while getting metrics from " + uri);
return null; // will not happen
}
diff --git a/integration-tests/it-exporter/it-exporter-servlet-jetty-sample/pom.xml b/integration-tests/it-exporter/it-exporter-servlet-jetty-sample/pom.xml
index 54dfdce94..59c2b8934 100644
--- a/integration-tests/it-exporter/it-exporter-servlet-jetty-sample/pom.xml
+++ b/integration-tests/it-exporter/it-exporter-servlet-jetty-sample/pom.xml
@@ -17,7 +17,7 @@
12.1.1
- 17
+ 25
diff --git a/integration-tests/it-exporter/it-exporter-servlet-tomcat-sample/pom.xml b/integration-tests/it-exporter/it-exporter-servlet-tomcat-sample/pom.xml
index 272bf5765..981349298 100644
--- a/integration-tests/it-exporter/it-exporter-servlet-tomcat-sample/pom.xml
+++ b/integration-tests/it-exporter/it-exporter-servlet-tomcat-sample/pom.xml
@@ -17,7 +17,7 @@
- 17
+ 25
diff --git a/integration-tests/it-pushgateway/src/test/java/io/prometheus/metrics/it/pushgateway/PushGatewayIT.java b/integration-tests/it-pushgateway/src/test/java/io/prometheus/metrics/it/pushgateway/PushGatewayIT.java
index beb83d7d9..2eb980759 100644
--- a/integration-tests/it-pushgateway/src/test/java/io/prometheus/metrics/it/pushgateway/PushGatewayIT.java
+++ b/integration-tests/it-pushgateway/src/test/java/io/prometheus/metrics/it/pushgateway/PushGatewayIT.java
@@ -41,7 +41,7 @@ public void setUp() throws IOException, URISyntaxException {
.withLogConsumer(LogConsumer.withPrefix("pushgateway"))
.waitingFor(Wait.forListeningPort());
sampleAppContainer =
- new GenericContainer<>("openjdk:17")
+ new GenericContainer<>("openjdk:25")
.withFileSystemBind(sampleAppVolume.getHostPath(), "/app", BindMode.READ_ONLY)
.withNetwork(network)
.withWorkingDirectory("/app")
diff --git a/integration-tests/it-spring-boot-smoke-test/pom.xml b/integration-tests/it-spring-boot-smoke-test/pom.xml
index acf3f19db..7d9f774f3 100644
--- a/integration-tests/it-spring-boot-smoke-test/pom.xml
+++ b/integration-tests/it-spring-boot-smoke-test/pom.xml
@@ -21,7 +21,7 @@
Spring Smoke Tests
- 17
+ 25
5.13.4
diff --git a/integration-tests/it-spring-boot-smoke-test/src/test/java/io/prometheus/metrics/it/springboot/ApplicationTest.java b/integration-tests/it-spring-boot-smoke-test/src/test/java/io/prometheus/metrics/it/springboot/ApplicationTest.java
index 490f397e0..86a26201b 100644
--- a/integration-tests/it-spring-boot-smoke-test/src/test/java/io/prometheus/metrics/it/springboot/ApplicationTest.java
+++ b/integration-tests/it-spring-boot-smoke-test/src/test/java/io/prometheus/metrics/it/springboot/ApplicationTest.java
@@ -5,7 +5,7 @@
import io.prometheus.client.it.common.ExporterTest;
import io.prometheus.metrics.expositionformats.generated.com_google_protobuf_4_32_1.Metrics;
import java.io.IOException;
-import java.net.URL;
+import java.net.URI;
import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.Test;
@@ -20,7 +20,7 @@ public void testPrometheusProtobufFormat() throws IOException {
ExporterTest.Response response =
ExporterTest.scrape(
"GET",
- new URL("http://localhost:8080/actuator/prometheus"),
+ URI.create("http://localhost:8080/actuator/prometheus"),
"Accept",
"application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;"
+ " encoding=delimited");
diff --git a/mise.toml b/mise.toml
index f34ba2014..751c9e571 100644
--- a/mise.toml
+++ b/mise.toml
@@ -1,7 +1,7 @@
[tools]
"go:github.com/gohugoio/hugo" = "v0.150.1"
"go:github.com/grafana/oats" = "0.4.1"
-java = "temurin-21.0.8+9.0.LTS"
+java = "temurin-25.0.0+36.0.LTS"
lychee = "0.20.1"
protoc = "32.1"
diff --git a/pom.xml b/pom.xml
index 54a0f5648..e976803ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -252,9 +252,9 @@
${java.version}
${java.version}
${java.version}
- 17
- 17
- 17
+ 25
+ 25
+ 25
true
-Xlint:all,-serial,-processing,-options
diff --git a/prometheus-metrics-exporter-httpserver/src/test/java/io/prometheus/metrics/exporter/httpserver/HTTPServerTest.java b/prometheus-metrics-exporter-httpserver/src/test/java/io/prometheus/metrics/exporter/httpserver/HTTPServerTest.java
index 06ab75b24..f939d6bd2 100644
--- a/prometheus-metrics-exporter-httpserver/src/test/java/io/prometheus/metrics/exporter/httpserver/HTTPServerTest.java
+++ b/prometheus-metrics-exporter-httpserver/src/test/java/io/prometheus/metrics/exporter/httpserver/HTTPServerTest.java
@@ -16,7 +16,6 @@
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
-import java.security.AccessController;
import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import java.util.concurrent.Executors;
@@ -46,7 +45,7 @@ public Result authenticate(HttpExchange exchange) {
HttpHandler handler =
exchange -> {
boolean found = false;
- Subject current = Subject.getSubject(AccessController.getContext());
+ Subject current = Subject.current();
for (Principal p : current.getPrincipals()) {
if (user.equals(p.getName())) {
found = true;
diff --git a/prometheus-metrics-exporter-servlet-jakarta/pom.xml b/prometheus-metrics-exporter-servlet-jakarta/pom.xml
index 263428a20..2b40e066e 100644
--- a/prometheus-metrics-exporter-servlet-jakarta/pom.xml
+++ b/prometheus-metrics-exporter-servlet-jakarta/pom.xml
@@ -19,7 +19,7 @@
io.prometheus.metrics.exporter.servlet.jakarta
- 17
+ 25
diff --git a/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmMemoryMetricsTest.java b/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmMemoryMetricsTest.java
index 122885911..a79ec3b3b 100644
--- a/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmMemoryMetricsTest.java
+++ b/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmMemoryMetricsTest.java
@@ -30,6 +30,7 @@ class JvmMemoryMetricsTest {
private final MemoryUsage memoryUsagePoolCollectionEdenSpace = Mockito.mock(MemoryUsage.class);
private final MemoryUsage memoryUsagePoolCollectionOldGen = Mockito.mock(MemoryUsage.class);
+ @SuppressWarnings("deprecation")
@BeforeEach
public void setUp() {
when(mockMemoryBean.getHeapMemoryUsage()).thenReturn(memoryUsageHeap);
diff --git a/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmThreadsMetricsTest.java b/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmThreadsMetricsTest.java
index 15cfb898f..cd651cc7f 100644
--- a/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmThreadsMetricsTest.java
+++ b/prometheus-metrics-instrumentation-jvm/src/test/java/io/prometheus/metrics/instrumentation/jvm/JvmThreadsMetricsTest.java
@@ -174,6 +174,7 @@ private ThreadWithInvalidId(long id, Runnable runnable) {
* Note that only Java versions < 21 call this to get the thread id. With Java 21 and newer it's
* no longer possible to make an invalid thread id.
*/
+ @SuppressWarnings("deprecation")
@Override
public long getId() {
return this.id;