Blue
Blue

Reputation: 1939

Jenkins and Ant - ant.bat not recognized but env vars are set well

I'm trying to set Jenkins to work with Ant but I get the following error:

Started by user anonymous Building in workspace C:.jenkins\workspace\CI Demo Checking out a fresh workspace because there's no workspace at C:.jenkins\workspace\CI Demo Cleaning local Directory . Checking out https:///svn/CI_Demo/trunk at revision '2013-10-27T19:34:31.549 +0000'

At revision 6 [CI Demo] $ cmd.exe /C '"ant.bat jar && exit %%ERRORLEVEL%%"' 'ant.bat' is not recognized as an internal or external command, operable program or batch file. Build step 'Invoke Ant' marked build as failure Finished: FAILURE

however, JAVA_HOME, ANT_HOME and I added the following to "Path": %ANT_HOME%\bin;%JAVA_HOME%\bin

And as you can see the command is recognizable when executed in CMD:

C:\Users\Administrator>java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

C:\Users\Administrator>ant -version Apache Ant(TM) version 1.9.2 compiled on July 8 2013

C:\Users\Administrator>ant.bat Buildfile: build.xml does not exist! Build failed

I would appreciate our help.

Thank you, N

Upvotes: 3

Views: 28048

Answers (4)

soumyadip
soumyadip

Reputation: 1

Just go and install Ant In Workspace plugin

Upvotes: 0

Gangnus
Gangnus

Reputation: 24484

You should make settings:

  • In windows
  • In Jenkins configuration
  • In Jenkins project

For concrete settings look at https://stackoverflow.com/a/23015039/715269

Upvotes: 0

cL83
cL83

Reputation: 489

Please set the JAVA_HOME, ANT_HOME, PATH at the Test Node Configuration page as below. While in your JOB Configuration page, make sure you restrict the job run in the correct Test Node and choose "DEFAULT" for your JDK and ANT VERSION. it shall working :D

enter image description here

Upvotes: 4

Blue
Blue

Reputation: 1939

Changing the service of the Tomcat that was the Jenkins container from localhost to Administrator solved the problem

Upvotes: 0

Related Questions