Gradle + quarkus-container-image-jib: AccessDeniedException on second run on Windows
See original GitHub issueDescribe 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 AccessDeniedException
s. 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:
- I assume you need a Windows machine (I have Windows 10)
- Download reproducer project and unzip it 2020-09-04_jib-problems.zip
- Run
./gradlew assemble -Dquarkus.container-image.build=true
- Change something in the code (e.g. in
ExampleResource
) - Run
./gradlew assemble -Dquarkus.container-image.build=true
again (now it should crash with theAccessDeniedException
)
Environment (please complete the following information):
- Windows 10
- Gradle
- Kotlin
- OpenJDK 11
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Getting "java.nio.file.AccessDeniedException" when trying to ...
AccessDeniedException " when trying to run gradle project with Netbeans ... Netbeans throws another error "Exception in thread "main" java.io ...
Read more >Gradle Build keeps running indefinitely after successful build ...
I can see a bunch of java.nio.file.AccessDeniedException exceptions in #8. Do you hit similar problems when building from the command line? When the...
Read more >Solving common problems - Gradle User Manual
Developers can always re-run the build with clean , and "fix" their builds ... part of its runtime classpath, will not be cached...
Read more >The Application Plugin - Gradle User Manual
You can run the application by executing the run task (type: JavaExec). ... Second, you need to tell Gradle the name of the...
Read more >The Gradle Wrapper - Gradle User Manual
You want to run a project with the Wrapper that already provides it. ... A shell script and a Windows batch script for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@geoand I will access to a windows machine tonight. I will give a try to those two issues.
Well I don’t think we can do much more in Quarkus