From a807eb5f6a5d7f5f115fe2311dedb01b74a42414 Mon Sep 17 00:00:00 2001 From: w0pp <157312110+w0pp@users.noreply.github.com> Date: Sun, 3 Mar 2024 11:31:38 +0100 Subject: [PATCH 1/2] Fix wrong volume host path being used on Windows --- .../io/quarkus/devservices/common/Volumes.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/Volumes.java b/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/Volumes.java index 39219be41eed6..3b56144a78e32 100644 --- a/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/Volumes.java +++ b/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/Volumes.java @@ -18,19 +18,12 @@ private Volumes() { public static void addVolumes(GenericContainer container, Map volumes) { for (Map.Entry volume : volumes.entrySet()) { String hostLocation = volume.getKey(); - BindMode bindMode = BindMode.READ_WRITE; if (volume.getKey().startsWith(CLASSPATH)) { - URL url = Thread.currentThread().getContextClassLoader() - .getResource(hostLocation.replaceFirst(CLASSPATH, EMPTY)); - if (url == null) { - throw new IllegalStateException("Classpath resource at '" + hostLocation + "' not found!"); - } - - hostLocation = url.getPath(); - bindMode = BindMode.READ_ONLY; + container.withClasspathResourceMapping(hostLocation.replaceFirst(CLASSPATH, EMPTY), volume.getValue(), + BindMode.READ_ONLY); + } else { + container.withFileSystemBind(hostLocation, volume.getValue(), BindMode.READ_WRITE); } - - container.withFileSystemBind(hostLocation, volume.getValue(), bindMode); } } } From 07bfe63e993791b3442d6827dc86cae0543dd822 Mon Sep 17 00:00:00 2001 From: w0pp <157312110+w0pp@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:10:28 +0100 Subject: [PATCH 2/2] Fix build failing due to unused import --- .../src/main/java/io/quarkus/devservices/common/Volumes.java | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/Volumes.java b/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/Volumes.java index 3b56144a78e32..2488bcf52540e 100644 --- a/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/Volumes.java +++ b/extensions/devservices/common/src/main/java/io/quarkus/devservices/common/Volumes.java @@ -1,6 +1,5 @@ package io.quarkus.devservices.common; -import java.net.URL; import java.util.Map; import org.testcontainers.containers.BindMode;