Repository: quarkusio/quarkus
Issue: Native container build with debug symbols fails during copying of jar sources

**Describe the bug**
When trying to build a native image with debug symbols in the quarkus quickstart project the build fails.  I originally spotted this in my custom project and was able to replicate the same problem in the hibernate-orm-quickstart.  Maybe I'm doing something wrong, or maybe this is actually a bug?

**Expected behavior**
The build should succeed.

**Actual behavior**
The following error message is logged as the build fails:

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.10.3.Final:native-image (default) on project hibernate-orm-quickstart: Failed to generate native image: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Unable to copy from C:\\path\\to\\mvn\\repo\\jakarta\\annotation\\jakarta.annotation-api\\1.3.5\\jakarta.annotation-api-1.3.5-sources.jar to C:\\path\\to\\quarkus-quickstarts\\hibernate-orm-quickstart\\target\\hibernate-orm-quickstart-1.0-SNAPSHOT-native-image-source-jar\\lib\\jakarta.annotation.jakarta.annotation-api-1.3.5-sources.jar
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.copyJarSourcesToLib(NativeImageBuildStep.java:423)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:93)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:972)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.nio.file.NoSuchFileException: C:\\path\\to\\mvn\\repo\\jakarta\\annotation\\jakarta.annotation-api\\1.3.5\\jakarta.annotation-api-1.3.5-sources.jar -> C:\\path\\to\\quarkus-quickstarts\\hibernate-orm-quickstart\\target\\hibernate-orm-quickstart-1.0-SNAPSHOT-native-image-source-jar\\lib\\jakarta.annotation.jakarta.annotation-api-1.3.5-sources.jar
[ERROR]         at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
[ERROR]         at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
[ERROR]         at java.base/sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:202)
[ERROR]         at java.base/sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:283)
[ERROR]         at java.base/java.nio.file.Files.copy(Files.java:1294)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.copyJarSourcesToLib(NativeImageBuildStep.java:421)
[ERROR]         ... 13 more
[ERROR] -> [Help 1]


**To Reproduce**

Run this as recommended on https://quarkus.io/guides/building-native-image#debugging-native-executable to download the sources jars (this doesn't seem to make any difference): `mvn dependency:sources`

Run: `mvn clean install -DskipTests -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.debug.enabled=true`

In project: https://github.com/quarkusio/quarkus-quickstarts/tree/master/hibernate-orm-quickstart

**Environment:**
 - Output of `uname -a` or `ver`: 
ver
Microsoft Windows [Version 10.0.19041.388]
 - Output of `java -version`: 
java -version
openjdk version "11.0.7" 2020-04-14 LTS
OpenJDK Runtime Environment Corretto-11.0.7.10.1 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.7.10.1 (build 11.0.7+10-LTS, mixed mode)
 - Quarkus version or git rev: https://github.com/quarkusio/quarkus-quickstarts/commit/6fc48e99980ff8a3e2fe0c40e75da2f468108398
 - Build tool (ie. output of `mvnw --version` or `gradlew --version`): 
 mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\\ProgramData\\chocolatey\\lib\\maven\\apache-maven-3.6.3\\bin\\..
Java version: 11.0.7, vendor: Amazon.com Inc., runtime: C:\\Program Files\\Amazon Corretto\\jdk11.0.7_10
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"


Changed files:
core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java

diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
index 6671453994f..ae164594a3d 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
@@ -447,6 +447,10 @@ private void copyJarSourcesToLib(OutputTargetBuildItem outputTargetBuildItem,
         Path targetDirectory = outputTargetBuildItem.getOutputDirectory()
                 .resolve(outputTargetBuildItem.getBaseName() + "-native-image-source-jar");
         Path libDir = targetDirectory.resolve(JarResultBuildStep.LIB);
+        File libDirFile = libDir.toFile();
+        if (!libDirFile.exists()) {
+            libDirFile.mkdirs();
+        }
 
         final List<AppDependency> appDeps = curateOutcomeBuildItem.getEffectiveModel().getUserDependencies();
         for (AppDependency appDep : appDeps) {