



The simplest scenario should have at least one goal. Further, it contains the definition of goals ( target ), dependencies ( depends ) and properties ( property ). The text is opened (and closed) by the project tag, in which you can specify the project name and default goal. We get the same result if, when calling ant, we specify hello as the parameter :īuild script is a regular XML file. What happened Ant found the script file with the default name (build.xml) and executed target with the name hello, also specified by default in the project tag using the default attribute (note that we also specified the project name in the project tag using the name attribute ). We create a hello subdirectory in the home directory (in Linux the mkdir command does this, in Windows - the md command ) and save there a file called build.xml containing the script proposed above. If a similar message is received - everything is in order. We check the performance by calling ant at the command line:Īpache Ant (TM) version 1.10.1 compiled on February 2 2017 Then add the path to the bin directory (C: \ Program Files \ Apache Ant \ bin) to the Path system variable.

Copy the contents of the archive to any directory, for example, to “C: \ Program Files \ Apache Ant”. Windows: visit the website, go to the Download / Binary Distributions section and download the apache-ant-1.10.1-bin.zip archive (maybe now there is already a more recent version). The CentOS 6.8 repository version 1.7.1, so it is better to use the script described in the previous article. Important: we need version no lower than 1.8. Linux: install from the repository with a command like sudo apt-get install ant (replace apt-get with yum if necessary). Ant usage is the same on Linux and Windows. Build scripts and examples in Java are tested on Linux (Simply Linux 7.95.0, CentOS Linux 6.8) and on Windows (XP / 7). We need the Java SE Development Kit (JDK, download at ), your favorite text editor (on Linux - vi / vim / gedit, for Windows I recommend Notepad ++) and basic working skills on the command line. We’ll write a script for the full assembly and testing cycle of the training project.We learn the minimum required list of tasks.We will deal with the principles of work and the XML format of the build script.Let's write a simple HelloWorld script.We will go through five simple steps to start using Ant: Despite its Java focus, web developers also use this tool. Ant uses a script, which is a regular XML file. Apache Ant should be familiar to every Java programmer: it is a popular build tool written entirely in Java.
