ARTIFACTORY: Resolving Gradle builds permission denied error in Azure devops pipeline

AuthorFullName__c
Deepti Sharma
articleNumber
000006015
FirstPublishedDate
2024-01-29T15:07:37Z
lastModifiedDate
2025-07-22

ARTIFACTORY: Resolving Gradle builds permission denied error in Azure devops pipeline

If you come across any permission denied error while running Gradle builds in Azure devops pipeline such as below:-

[Error] fork/exec ./gradlew: permission denied

##[error]Error: Command failed: /opt/hostedtoolcache/jf/2.52.9/x64/jf gradle artifactoryPublish -d -b /home/vsts/work/1/s/build.gradle --build-name="***jfrog.gradlerepo" --build-number="20240123.11"


The above error indicates that Gradle likely exists in the correct place, but it is not executable and the pipeline fails with permission denied error.

Solution:

You need to update the execution permission for this file . If you are running locally you can run chmod in your terminal:-

#chmod +x gradlew


In azure devops pipeline, please try giving all permissions for that file by adding below command line task in your Azure pipelines.YML file 

- task: CmdLine@2
  inputs:
    script: 'chmod 777 gradlew'