snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

Gradle + quarkus-container-image-jib: AccessDeniedException on second run on Windows #169

Closed snowdrop-bot closed 4 years ago

snowdrop-bot commented 4 years ago

Describe the bug I try to build a container image with the quarkus-container-image-jib extension in my Quarkus (gradle, Kotlin) project on my Windows 10 PC. The first run works (./gradlew assemble -Dquarkus.container-image.build=true). On the second and any further runs l I always get AccessDeniedExceptions. When I stop the gradle deamons (./gradlew --stop) or kill them via the TaskManager, it works again for one run but then I end up with the same issue.

Full exception:

17:15:27: Executing task 'assemble -Dquarkus.container-image.build=true'...

> Task :quarkusGenerateCode
preparing quarkus application
kotlin scripting plugin: root project 'code-with-quarkus'.compileQuarkus-generated-sourcesKotlin - configuration not found: quarkus-generated-sourcesKotlinScriptDef, the plugin is probably applied by a mistake

> Task :quarkusGenerateCodeTests
preparing quarkus application
kotlin scripting plugin: root project 'code-with-quarkus'.compileQuarkus-test-generated-sourcesKotlin - configuration not found: quarkus-test-generated-sourcesKotlinScriptDef, the plugin is probably applied by a mistake

> Task :compileKotlin
> Task :compileJava NO-SOURCE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :inspectClassesForKotlinIC
> Task :jar

> Task :quarkusBuild FAILED
building quarkus jar
7 actionable tasks: 6 executed, 1 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step io.quarkus.deployment.pkg.steps.JarResultBuildStep#buildRunnerJar threw an exception: java.lang.IllegalStateException: java.nio.file.AccessDeniedException: C:\development\quarkus-debugging\bug-reports\2020-09-04_jib-problems\build\lib
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:941)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
    at java.base/java.lang.Thread.run(Thread.java:830)
    at org.jboss.threads.JBossThread.run(JBossThread.java:479)
  Caused by: java.nio.file.AccessDeniedException: C:\development\quarkus-debugging\bug-reports\2020-09-04_jib-problems\build\lib
    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:506)
    at java.base/java.nio.file.Files.createDirectory(Files.java:693)
    at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:800)
    at java.base/java.nio.file.Files.createDirectories(Files.java:786)
    at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildLegacyThinJar(JarResultBuildStep.java:418)
    at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildRunnerJar(JarResultBuildStep.java:192)
    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:567)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:932)
    ... 7 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 4s
17:15:32: Task execution finished 'assemble -Dquarkus.container-image.build=true'.

To Reproduce Steps to reproduce the behavior:

  1. I assume you need a Windows machine (I have Windows 10)
  2. Download reproducer project and unzip it 2020-09-04_jib-problems.zip
  3. Run ./gradlew assemble -Dquarkus.container-image.build=true
  4. Change something in the code (e.g. in ExampleResource)
  5. Run ./gradlew assemble -Dquarkus.container-image.build=true again (now it should crash with the AccessDeniedException)

Environment (please complete the following information):


https://github.com/quarkusio/quarkus/issues/11900


$upstream:11900$