Repository: quarkusio/quarkus
Issue: Native build with jib and gradle fails on quarkus 3.0.0.CR1

### Describe the bug

Trying to build a simple quarkus app with jib fails with following exception:

On my windows developer system:
```
Starting Gradle Daemon...
Gradle Daemon started in 1 s 520 ms

> Task :processResources UP-TO-DATE
> Task :quarkusGenerateCode UP-TO-DATE
> Task :quarkusGenerateCodeDev UP-TO-DATE
> Task :compileJava UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :jar
> Task :quarkusGenerateCodeTests UP-TO-DATE
> Task :compileTestJava UP-TO-DATE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :compileIntegrationTestJava UP-TO-DATE
> Task :processIntegrationTestResources NO-SOURCE
> Task :integrationTestClasses UP-TO-DATE
22.3.0.1-Final-java17: Pulling from quarkus/ubi-quarkus-mandrel
...
Digest: sha256:5f24fe7559dd5ed8f5765ea44de42395c7ae13f8ea48f75dd4ca3a67c3a91486
Status: Downloaded newer image for quay.io/quarkus/ubi-quarkus-mandrel:22.3.0.1-Final-java17
quay.io/quarkus/ubi-quarkus-mandrel:22.3.0.1-Final-java17
========================================================================================================================
GraalVM Native Image: Generating 'health-server-undefined-runner' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                   (17.8s @ 0.31GB)
 Version info: 'GraalVM 22.3.0.1-Final Java 17 Mandrel Distribution'
 Java version info: '17.0.5+8'
 C compiler: gcc (redhat, x86_64, 8.5.0)
 Garbage collector: Serial GC
 2 user-specific feature(s)
 - io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
 - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
[2/7] Performing analysis...  [*******]                                                                 (46.7s @ 2.16GB)
  12,258 (89.78%) of 13,653 classes reachable
  17,695 (59.23%) of 29,876 fields reachable
  62,061 (56.41%) of 110,018 methods reachable
     585 classes,   136 fields, and 2,960 methods registered for reflection
      63 classes,    68 fields, and    55 methods registered for JNI access
       4 native libraries: dl, pthread, rt, z
[3/7] Building universe...                                                                               (6.3s @ 4.51GB)
[4/7] Parsing methods...      [**]                                                                       (4.2s @ 4.65GB)
[5/7] Inlining methods...     [***]                                                                      (2.2s @ 2.83GB)
[6/7] Compiling methods...    [******]                                                                  (32.5s @ 2.81GB)
[7/7] Creating image...                                                                                  (5.2s @ 1.10GB)
  22.93MB (47.92%) for code area:    40,468 compilation units
  24.60MB (51.41%) for image heap:  303,638 objects and 17 resources
 327.06KB ( 0.67%) for other data
  47.84MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 packages in code area:                               Top 10 object types in image heap:
   1.64MB sun.security.ssl                                     5.16MB byte[] for code metadata
   1.05MB java.util                                            2.93MB java.lang.Class
 741.65KB java.lang.invoke                                     2.77MB java.lang.String
 718.51KB com.sun.crypto.provider                              2.52MB byte[] for general heap data
 491.66KB io.netty.buffer                                      2.30MB byte[] for java.lang.String
 472.69KB java.lang                                            1.03MB com.oracle.svm.core.hub.DynamicHubCompanion
 450.59KB sun.security.x509                                  689.06KB java.util.HashMap$Node
 422.53KB java.util.concurrent                               674.94KB byte[] for reflection metadata
 413.01KB io.vertx.core.http.impl                            560.07KB byte[] for embedded resources
 395.60KB java.io                                            546.27KB java.lang.String[]
  15.93MB for 462 more packages                                4.72MB for 3029 more object types
------------------------------------------------------------------------------------------------------------------------
                        4.8s (3.9% of total time) in 36 GCs | Peak RSS: 5.86GB | CPU load: 5.79
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /project/health-server-undefined-runner (executable)
 /project/health-server-undefined-runner-build-output-stats.json (json)
 /project/health-server-undefined-runner-timing-stats.json (raw)
 /project/health-server-undefined-runner.build_artifacts.txt (txt)
========================================================================================================================
Finished generating 'health-server-undefined-runner' in 2m 0s.
LOCALAPPDATA environment is invalid or missing
> Task :quarkusAppPartsBuild FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':quarkusAppPartsBuild'.
> There was a failure while executing work items
   > A failure occurred while executing io.quarkus.gradle.tasks.worker.BuildWorker
      > io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        	[error]: Build step io.quarkus.container.image.jib.deployment.JibProcessor#buildFromNative threw an exception: java.lang.RuntimeException: Unable to create container image
        	at io.quarkus.container.image.jib.deployment.JibProcessor.containerize(JibProcessor.java:255)
        	at io.quarkus.container.image.jib.deployment.JibProcessor.buildFromNative(JibProcessor.java:221)
        	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
        	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
        	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        	at java.base/java.lang.Thread.run(Thread.java:833)
        	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
        Caused by: com.google.cloud.tools.jib.api.CacheDirectoryCreationException: Could not create cache directory
        	at com.google.cloud.tools.jib.api.Containerizer.getApplicationLayersCacheDirectory(Containerizer.java:366)
        	at com.google.cloud.tools.jib.api.JibContainerBuilder.toBuildContext(JibContainerBuilder.java:728)
        	at com.google.cloud.tools.jib.api.JibContainerBuilder.containerize(JibContainerBuilder.java:604)
        	at io.quarkus.container.image.jib.deployment.JibProcessor.containerize(JibProcessor.java:248)
        	... 12 more
        Caused by: java.nio.file.AccessDeniedException: C:\\WINDOWS\\jib-core-application-layers-cache
        	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
        	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
        	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
        	at java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:521)
        	at java.base/java.nio.file.Files.createDirectory(Files.java:700)
        	at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)
        	at java.base/java.nio.file.Files.createDirectories(Files.java:793)
        	at com.google.cloud.tools.jib.api.Containerizer.getApplicationLayersCacheDirectory(Containerizer.java:364)
        	... 15 more
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 10s
9 actionable tasks: 2 executed, 7 up-to-date

```

On the github runners:
```
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :processResources
> Task :quarkusGenerateCode
> Task :quarkusGenerateCodeDev
> Task :compileJava
> Task :classes
> Task :jar
> Task :quarkusGenerateCodeTests
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :compileIntegrationTestJava
> Task :processIntegrationTestResources NO-SOURCE
> Task :integrationTestClasses
22.3.0.1-Final-java17: Pulling from quarkus/ubi-quarkus-mandrel
Digest: sha256:5f24fe7559dd5ed8f5765ea44de42395c7ae13f8ea[48](https://github.com/QUMEA/health-server/actions/runs/4609842386/jobs/8147536859?pr=45#step:7:50)f75dd4ca3a67c3a91486
Status: Image is up to date for quay.io/quarkus/ubi-quarkus-mandrel:22.3.0.1-Final-java17
quay.io/quarkus/ubi-quarkus-mandrel:22.3.0.1-Final-java17
========================================================================================================================
GraalVM Native Image: Generating 'health-server-undefined-runner' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                   (10.3s @ 0.32GB)
 Version info: 'GraalVM 22.3.0.1-Final Java 17 Mandrel Distribution'
 Java version info: '17.0.5+8'
 C compiler: gcc (redhat, x86_64, 8.5.0)
 Garbage collector: Serial GC
 2 user-specific feature(s)
 - io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
 - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
> Task :quarkusAppPartsBuild

[2/7] Performing analysis...  [******]                                                                 (116.3s @ 2.22GB)
  12,252 (89.78%) of 13,647 classes reachable
  17,695 (59.23%) of 29,876 fields reachable
  62,0[49](https://github.com/QUMEA/health-server/actions/runs/4609842386/jobs/8147536859?pr=45#step:7:51) (56.41%) of 110,001 methods reachable
     579 classes,   136 fields, and 2,954 methods registered for reflection
      63 classes,    68 fields, and    55 methods registered for JNI access
       4 native libraries: dl, pthread, rt, z
[3/7] Building universe...                                                                              (15.8s @ 1.65GB)
[4/7] Parsing methods...      [****]                                                                    (13.4s @ 2.46GB)
[5/7] Inlining methods...     [***]                                                                      (7.3s @ 1.31GB)
[6/7] Compiling methods...    [**********]                                                              (98.7s @ 1.36GB)
[7/7] Creating image...                                                                                  (6.9s @ 2.11GB)
  22.92MB (47.92%) for code area:    40,462 compilation units
  24.59MB (51.41%) for image heap:  302,027 objects and 17 resources
 328.64KB ( 0.67%) for other data
  47.84MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 packages in code area:                               Top 10 object types in image heap:
   1.64MB sun.security.ssl                                     5.16MB byte[] for code metadata
   1.05MB java.util                                            2.92MB java.lang.Class
 740.89KB java.lang.invoke                                     2.76MB java.lang.String
 718.[50](https://github.com/QUMEA/health-server/actions/runs/4609842386/jobs/8147536859?pr=45#step:7:52)KB com.sun.crypto.provider                              2.[51](https://github.com/QUMEA/health-server/actions/runs/4609842386/jobs/8147536859?pr=45#step:7:53)MB byte[] for general heap data
 491.83KB io.netty.buffer                                      2.29MB byte[] for java.lang.String
 472.72KB java.lang                                            1.03MB com.oracle.svm.core.hub.DynamicHubCompanion
 450.59KB sun.security.x509                                  697.92KB java.util.HashMap$Node
 422.44KB java.util.concurrent                               674.[54](https://github.com/QUMEA/health-server/actions/runs/4609842386/jobs/8147536859?pr=45#step:7:56)KB byte[] for reflection metadata
 412.95KB io.vertx.core.http.impl                            560.07KB byte[] for embedded resources
 395.58KB java.io                                            540.70KB java.lang.String[]
  15.93MB for 462 more packages                                4.68MB for 3028 more object types
------------------------------------------------------------------------------------------------------------------------
                        13.5s (4.9% of total time) in [55](https://github.com/QUMEA/health-server/actions/runs/4609842386/jobs/8147536859?pr=45#step:7:57) GCs | Peak RSS: 3.38GB | CPU load: 1.[92](https://github.com/QUMEA/health-server/actions/runs/4609842386/jobs/8147536859?pr=45#step:7:94)
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /project/health-server-undefined-runner (executable)
 /project/health-server-undefined-runner-build-output-stats.json (json)
 /project/health-server-undefined-runner-timing-stats.json (raw)
 /project/health-server-undefined-runner.build_artifacts.txt (txt)
========================================================================================================================
Finished generating 'health-server-undefined-runner' in 4m 36s.
Base image 'quay.io/quarkus/quarkus-micro-image:2.0' does not use a specific image digest - build may not be reproducible

> Task :quarkusAppPartsBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusAppPartsBuild'.
> There was a failure while executing work items
   > A failure occurred while executing io.quarkus.gradle.tasks.worker.BuildWorker
      > java.lang.NullPointerException (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
```

### Expected behavior

Just works as with quarkus 2.x

### Actual behavior

_No response_

### How to Reproduce?

Try to build and run native quarkusIntTest together with the `io.quarkus:quarkus-container-image-jib` extension

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

_No response_

### Output of `java -version`

17

### GraalVM version (if different from Java)

22.3.0.1

### Quarkus version or git rev

3.0.0.CR1

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

Gradle 8.0

### Additional information

_No response_

Changed files:
devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/worker/BuildWorker.java

diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/worker/BuildWorker.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/worker/BuildWorker.java
index 25054b8134b..00a31cffb9a 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/worker/BuildWorker.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/worker/BuildWorker.java
@@ -59,7 +59,7 @@ public void execute() {
                     LOGGER.warn("AugmentResult.results = null");
                 } else {
                     LOGGER.info("AugmentResult.results = {}", results.stream().map(ArtifactResult::getPath)
-                            .map(Object::toString).collect(Collectors.joining("\\n    ", "\\n    ", "")));
+                            .map(r -> r == null ? "null" : r.toString()).collect(Collectors.joining("\\n    ", "\\n    ", "")));
                 }
                 JarResult jar = result.getJar();
                 LOGGER.info("AugmentResult:");