Omsairam
Omsairam

Reputation: 370

Jenkins: gradle is not being recognized during build

I already installed grade and set up in the environment variable PATH

even I am getting an error.

gradle.bat is not recognized as an internal or external command in Jenkins

the configuration is

enter image description here

and the workspace is like enter image description here

and the default task is in build.gradle is

task build{
  dependsOn copyDocsSetup
}

while I am building using Jenkin I am getting an error like the below

Started by user ajay
Building in workspace C:\Program Files (x86)\Jenkins\workspace\ARS BUILD
[Gradle] - Launching build.
[ARS BUILD] $ cmd.exe /C "gradle.bat -b '"C:\Program Files (x86)\Jenkins\workspace\ARS BUILD\gradleBuildScript\BuildARSSystem\ARSBuild\build.gradle"' && exit %%ERRORLEVEL%%"
'gradle.bat' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE

how to solve it, I am very new in Jenkins world. thanks in advance.

Upvotes: 1

Views: 7451

Answers (2)

Lai Lee
Lai Lee

Reputation: 1312

You can use Gradle Wrapper in your project. enter image description here

Upvotes: 0

Wilco Greven
Wilco Greven

Reputation: 2115

Adding a Gradle installation in your global Jenkins configuration should fix your problem.

But a better solution is to use the Gradle wrapper. See the relevant section on the Gradle wrapper in the Gradle User Guide for how to configure it. The Gradle wrapper will automatically download the correct Gradle version, so you don't have to install one yourself on the Jenkins machine.

Upvotes: 5

Related Questions