Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

AccessDeniedException in check style

Dawid Hyzy March 8, 2024

I created bitbucket pipeline to run detekt with check style

image: alvrme/alpine-android:android-34-jdk17

pipelines:
pull-requests:
'**':
- step: # Runs the detekt gradle task
name: Check code quality.
caches:
- gradle
- gradle-wrapper
- gradle-configuration
script:
- JAVA_OPTS="-Xmx2g -XX:MaxPermSize=1g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
- export GRADLE_OPTS='-XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -Dorg.gradle.jvmargs="-Xmx2g -XX:MaxMetaspaceSize=1g -XX:ReservedCodeCacheSize=440m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" -Dorg.gradle.parallel=false -Dorg.gradle.daemon=false -Dorg.gradle.configureondemand=true'
- ./gradlew detekt
after-script: # Post comments based on the report xml created by running detekt command
- pipe: atlassian/checkstyle-report:0.4.0

definitions:
caches:
gradle-wrapper: ~/.gradle/wrapper
gradle-configuration: ~/.gradle/configuration-cache

Unfortunately, check style fails with


Exception in thread "main" java.lang.RuntimeException: java.nio.file.AccessDeniedException: /opt/atlassian/pipelines/agent/build/.gradle/configuration-cache/eof19v0cm74wbz9wrfyaykwjt
at se.bjurr.violations.lib.reports.ReportsFinder.findAllReports(ReportsFinder.java:51)at se.bjurr.violations.lib.ViolationsApi.violations(ViolationsApi.java:89)

at com.atlassian.bitbucket.pipelines.checkstyle.report.Main.main(Main.java:98)

Caused by: java.nio.file.AccessDeniedException: /opt/atlassian/pipelines/agent/build/.gradle/configuration-cache/eof19v0cm74wbz9wrfyaykwjtat sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)

at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:427)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:300)
at java.nio.file.FileTreeWalker.next(FileTreeWalker.java:372)
at java.nio.file.Files.walkFileTree(Files.java:2706)
at java.nio.file.Files.walkFileTree(Files.java:2742)
at se.bjurr.violations.lib.reports.ReportsFinder.findAllReports(ReportsFinder.java:28)
... 2 more

 What am I missing?

1 answer

0 votes
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 8, 2024

@Dawid Hyzy hi. Seems like the system is not allowing access to the files mentioned in the directory named in the error message.

Check the permissions, ownership and existence of the directory and files within it.

 

Regards, Igor

Dawid Hyzy March 8, 2024

This is a Gradle configuration cache file created during the 

./gradlew detekt

task execution.

.gradle directory is not committed to the repository.

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events