I have a gradle project which I want to build on a self hosted agent in Azure DevOps.
Here is my pipeline with the gradle task:
trigger:
- azure-pipelines
pool:
name: Default
steps:
- task: Gradle@2
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
javaHomeOption: 'JDKVERSION'
jdkVersionOption: 1.8
jdkArchitectureOption: x64
jdkUserInputPath: '/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
tasks: 'build'
But if I run the pipeline I got the following problem:
Error: The process '/azp/agent/_work/1/s/gradlew' failed with exit code 126
at ExecState._setResult (/azp/agent/_work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.176.0/node_modules/azure-pipelines-task-lib/toolrunner.js:816:25)
at ExecState.CheckComplete (/azp/agent/_work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.176.0/node_modules/azure-pipelines-task-lib/toolrunner.js:799:18)
at ChildProcess.<anonymous> (/azp/agent/_work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.176.0/node_modules/azure-pipelines-task-lib/toolrunner.js:721:19)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Socket.<anonymous> (internal/child_process.js:351:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:509:12)
SYSTEMVSSCONNECTION exists true
/azp/agent/_work/1/s/gradlew build
/usr/bin/env: 'sh': Not a directory
##[error]Error: The process '/azp/agent/_work/1/s/gradlew' failed with exit code 126
I have tried manually to run the gradlew wrapper on the agent, it worked without a problem.