Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ant - not recognized as an internal

Tags:

path

jenkins

ant

I have installed ant(apache-ant-1.7.0). But when i run the ant command in dos command prompt, it says

‘ant’ is not recognized as an internal or external command, operable program or batch file.

where i'm going wrong.

like image 304
Srinivasan Avatar asked Oct 19 '09 06:10

Srinivasan


3 Answers

That just means it's not on the path.

Edit your PATH environment variable to include Ant's "bin" directory. The exact steps for editing your path with depend on your operating system, but for example on XP:

  • Bring up Explorer (Windows-E)
  • Right-click on "My Computer" and select "Properties"
  • On the "Advanced" tab, click on "Environment Variables"
  • If the set of "user variables" already contains a PATH entry, edit that. Otherwise create a new entry. (If you want it to affect all users, set it as a system environment variable.)
  • Add the Ant bin directory without any quotes. Use a semi-colon to separate it from another entry. For example, you might have:

    c:\Program Files\Utils;c:\Program Files\Ant 1.7\bin
    
  • Start a new Command Prompt to see the changes (they won't affect existing windows)
like image 177
Jon Skeet Avatar answered Oct 04 '22 23:10

Jon Skeet


For anyone that comes across this article:
Always remember, don't put a space after each semicolon.


Good:
C:\Ninja;C:\ant

Bad:
C:\Ninja; C:\ant

like image 29
RichardJohnn Avatar answered Oct 05 '22 01:10

RichardJohnn


In windows:

  • ANT_HOME environment variable should be set to your ant install dir. If you haven't such, download ant and unzip it.

In Jenkins configuration

  • %ANT_HOME%\bin should be added to PATH
  • Go to Jenkins / Manage Jenkins / Configure System / Ant Installation.
    • Uncheck Install Automatically
    • Give name for Ant (AntName)
    • Put ant install dir into ANT_HOME

In Jenkins project

  • Got to Project/Configure/Build/Invoke Ant. (Add Build Step/Invoke Ant if you haven't any). In Ant Version change Default to AntName (set by you in the Jenkins configuration)
like image 24
Gangnus Avatar answered Oct 05 '22 00:10

Gangnus