Repository: quarkusio/quarkus
Issue: Quarkus Tests with SmallRye Health Extension Sometimes Fail When Run In Parallel

### Describe the bug

After adding extension `io.quarkus:quarkus-smallrye-health` running multiple tests in parallel sometimes causes `NoSuchFileException`.

```
Caused by: java.nio.file.NoSuchFileException: /var/folders/1z/vlh4t0fj7qx8dldd244qst9w0000gp/T/quarkus/com.example/health-ui-no-such-file/io.smallrye/smallrye-health-ui/3.1.2/healthui.js
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:422)
	at java.base/java.nio.file.Files.readAllBytes(Files.java:3206)
	at io.quarkus.smallrye.health.deployment.SmallRyeHealthProcessor.updateApiUrl(SmallRyeHealthProcessor.java:500)
	at io.quarkus.smallrye.health.deployment.SmallRyeHealthProcessor.registerUiExtension(SmallRyeHealthProcessor.java:436)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:821)
```

Best I can tell digging through the source, ui resources are being extracted from the `smallrye-health-ui` jar and put into a temporary directory, but that location is not unique per test and is being cleaned prior to extraction, so tests running in parallel can cause already extracted files to be deleted and subsequent errors on read.

I'm running multiple tests in parallel in gradle with:

```
test {
  maxParallelForks = 4
}
```

This is still an issue even with the health ui is disabled via `quarkus.smallrye-health.ui.enable = false`

### Expected behavior

Tests run in parallel do not fail due to the extension `io.quarkus:quarkus-smallrye-health` being applied.

### Actual behavior

Build fails with above exception.

### How to Reproduce?

[health-ui-no-such-file.zip](https://github.com/quarkusio/quarkus/files/7489383/health-ui-no-such-file.zip)

The above project reproduces the issue pretty consistently for me just running `./gradlew build`

### Output of `uname -a` or `ver`

Darwin WMac5205964 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64

### Output of `java -version`

openjdk version "11.0.11" 2021-04-20

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.4.1.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Gradle 7.2

### Additional information

_No response_

Changed files:
extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java

diff --git a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java
index cf0bac72245..efa2a2e4045 100644
--- a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java
+++ b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java
@@ -61,6 +61,7 @@
 import io.quarkus.kubernetes.spi.KubernetesHealthReadinessPathBuildItem;
 import io.quarkus.kubernetes.spi.KubernetesHealthStartupPathBuildItem;
 import io.quarkus.maven.dependency.ResolvedDependency;
+import io.quarkus.runtime.LaunchMode;
 import io.quarkus.smallrye.health.deployment.spi.HealthBuildItem;
 import io.quarkus.smallrye.health.runtime.QuarkusAsyncHealthCheckFactory;
 import io.quarkus.smallrye.health.runtime.ShutdownReadinessListener;
@@ -433,8 +434,10 @@ void registerUiExtension(
                 Path tempPath = WebJarUtil.copyResourcesForDevOrTest(liveReloadBuildItem, curateOutcomeBuildItem, launchMode,
                         artifact,
                         HEALTH_UI_WEBJAR_PREFIX);
-                updateApiUrl(tempPath.resolve(JS_FILE_TO_UPDATE), healthPath);
-                updateApiUrl(tempPath.resolve(INDEX_FILE_TO_UPDATE), healthPath);
+                if (launchMode.equals(LaunchMode.DEVELOPMENT)) {
+                    updateApiUrl(tempPath.resolve(JS_FILE_TO_UPDATE), healthPath);
+                    updateApiUrl(tempPath.resolve(INDEX_FILE_TO_UPDATE), healthPath);
+                }
 
                 smallRyeHealthBuildProducer
                         .produce(new SmallRyeHealthBuildItem(tempPath.toAbsolutePath().toString(), healthUiPath));