Ant - Installation (Windows based)

About

Installation of Ant

System requirement

  • JDK installed on your system, version 1.8 or later
java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

Steps

Download and unzip

C:\apache-ant-1.10.8\

Add ant binary in path

_

Create the configuration file and set the JAVA_HOME

Create the configuration file antrc_pre.bat into your userprofile directory

The configuration file on Linux is called $HOME/.antrc

echo %USERPROFILE%\antrc_pre.bat
C:\Users\username\antrc_pre.bat
  • Add JAVA_HOME in it
set JAVA_HOME=C:\java\jdk1.8.0_231

Test

  • Test if java home is well set by calling ant
ant
# there is no java message, that's good
Buildfile: build.xml does not exist!
Build failed

Ant works. It just needs an individual buildfile as input.

Install the additional jars

  • From the ANT_HOME directory, run the following command to get the library dependencies of most of the Ant tasks that require them. Without this step, many of the optional Ant tasks will not be available. Example
cd C:\apache-ant-1.10.8
ant -f fetch.xml -Ddest=system
REM for IDE that include their own ant system, you can install them in the user scope
ant -f fetch.xml -Ddest=user

where:

  • fetch.xml is an Ant script that install almost all the dependencies the optional Ant tasks need.
  • -Ddest can take one of the following values:
    • system - store in Ant's lib directory (Recommended)
    • user - store in the user's home directory
    • optional - store in Ant's source code lib/optional directory, used if building Ant source code
.............
.............
[artifact:dependencies] Transferring 271K
[artifact:dependencies] Downloading: xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar
[artifact:dependencies] Transferring 189K
     [copy] Copying 3 files to C:\ant\lib
[artifact:dependencies] Downloading: xml-resolver/xml-resolver/1.2/xml-resolver-1.2.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar
[artifact:dependencies] Transferring 82K
     [copy] Copying 1 file to C:\ant\lib

networking:
[artifact:dependencies] Downloading: commons-net/commons-net/1.4.1/commons-net-1.4.1.pom
[artifact:dependencies] Transferring 4K
[artifact:dependencies] Downloading: oro/oro/2.0.8/oro-2.0.8.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: commons-net/commons-net/1.4.1/commons-net-1.4.1.jar
[artifact:dependencies] Transferring 176K
[artifact:dependencies] Downloading: oro/oro/2.0.8/oro-2.0.8.jar
[artifact:dependencies] Transferring 63K
     [copy] Copying 2 files to C:\ant\lib
[artifact:dependencies] Downloading: com/jcraft/jsch/0.1.42/jsch-0.1.42.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: com/jcraft/jsch/0.1.42/jsch-0.1.42.jar
[artifact:dependencies] Transferring 181K
     [copy] Copying 1 file to C:\ant\lib

regexp:
[artifact:dependencies] Downloading: regexp/regexp/1.3/regexp-1.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: regexp/regexp/1.3/regexp-1.3.jar
[artifact:dependencies] Transferring 24K
     [copy] Copying 1 file to C:\ant\lib

antlr:
[artifact:dependencies] Downloading: antlr/antlr/2.7.7/antlr-2.7.7.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: antlr/antlr/2.7.7/antlr-2.7.7.jar
[artifact:dependencies] Transferring 434K
     [copy] Copying 1 file to C:\ant\lib

bcel:
[artifact:dependencies] Downloading: bcel/bcel/5.1/bcel-5.1.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: regexp/regexp/1.2/regexp-1.2.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: bcel/bcel/5.1/bcel-5.1.jar
[artifact:dependencies] Transferring 503K
[artifact:dependencies] Downloading: regexp/regexp/1.2/regexp-1.2.jar
[artifact:dependencies] Transferring 29K
     [copy] Copying 2 files to C:\ant\lib

jdepend:
[artifact:dependencies] Downloading: jdepend/jdepend/2.9.1/jdepend-2.9.1.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: jdepend/jdepend/2.9.1/jdepend-2.9.1.jar
[artifact:dependencies] Transferring 56K
     [copy] Copying 1 file to C:\ant\lib

bsf:
[artifact:dependencies] Downloading: bsf/bsf/2.4.0/bsf-2.4.0.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.pom

[artifact:dependencies] Transferring 5K
[artifact:dependencies] Downloading: commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar

[artifact:dependencies] Transferring 37K
[artifact:dependencies] Downloading: bsf/bsf/2.4.0/bsf-2.4.0.jar
[artifact:dependencies] Transferring 110K
     [copy] Copying 2 files to C:\ant\lib

debugging:
[artifact:dependencies] Downloading: which/which/1.0/which-1.0.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: which/which/1.0/which-1.0.jar
[artifact:dependencies] Transferring 16K
     [copy] Copying 1 file to C:\ant\lib

jruby:
[artifact:dependencies] Downloading: org/jruby/jruby/0.9.8/jruby-0.9.8.pom
[artifact:dependencies] Transferring 5K
[artifact:dependencies] Downloading: org/jruby/shared/0.9.8/shared-0.9.8.pom
[artifact:dependencies] Transferring 4K
[artifact:dependencies] Downloading: asm/asm-commons/2.2.3/asm-commons-2.2.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: asm/asm-parent/2.2.3/asm-parent-2.2.3.pom
[artifact:dependencies] Transferring 2K
[artifact:dependencies] Downloading: asm/asm-tree/2.2.3/asm-tree-2.2.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: asm/asm/2.2.3/asm-2.2.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: asm/asm-commons/2.2.3/asm-commons-2.2.3.jar
[artifact:dependencies] Transferring 14K
[artifact:dependencies] Downloading: org/jruby/jruby/0.9.8/jruby-0.9.8.jar
[artifact:dependencies] Transferring 1644K
[artifact:dependencies] Downloading: asm/asm-tree/2.2.3/asm-tree-2.2.3.jar
[artifact:dependencies] Transferring 15K
[artifact:dependencies] Downloading: asm/asm/2.2.3/asm-2.2.3.jar
[artifact:dependencies] Transferring 34K
     [copy] Copying 4 files to C:\ant\lib

beanshell:
[artifact:dependencies] Downloading: org/beanshell/bsh/2.0b4/bsh-2.0b4.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/beanshell/beanshell/2.0b4/beanshell-2.0b4.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/beanshell/bsh/2.0b4/bsh-2.0b4.jar
[artifact:dependencies] Transferring 275K
     [copy] Copying 1 file to C:\ant\lib
[artifact:dependencies] Downloading: org/beanshell/bsh-core/2.0b4/bsh-core-2.0b4.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: org/beanshell/bsh-core/2.0b4/bsh-core-2.0b4.jar
[artifact:dependencies] Transferring 140K
     [copy] Copying 1 file to C:\ant\lib

rhino:
[artifact:dependencies] Downloading: rhino/js/1.6R7/js-1.6R7.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: rhino/js/1.6R7/js-1.6R7.jar
[artifact:dependencies] Transferring 794K
     [copy] Copying 1 file to C:\ant\lib

script:

javamail:
[artifact:dependencies] Downloading: javax/mail/mail/1.4/mail-1.4.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: javax/activation/activation/1.1/activation-1.1.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: javax/activation/activation/1.1/activation-1.1.jar
[artifact:dependencies] Transferring 61K
[artifact:dependencies] Downloading: javax/mail/mail/1.4/mail-1.4.jar
[artifact:dependencies] Transferring 379K
     [copy] Copying 2 files to C:\ant\lib

jspc:
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compiler-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote (http://repo1.maven.
org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compiler-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central (http://repo1.maven
.org/maven2)
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compiler-4.1.36.jar
[artifact:dependencies] Transferring 179K
     [copy] Copying 1 file to C:\ant\lib
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote (http://repo1.maven.
org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central (http://repo1.maven
.org/maven2)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime-4.1.36.jar
[artifact:dependencies] Transferring 70K
     [copy] Copying 1 file to C:\ant\lib
[artifact:dependencies] Downloading: javax/servlet/servlet-api/2.3/servlet-api-2.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: javax/servlet/servlet-api/2.3/servlet-api-2.3.jar
[artifact:dependencies] Transferring 76K
     [copy] Copying 1 file to C:\ant\lib

jai:
[artifact:dependencies] Downloading: javax/media/jai-core/1.1.3/jai-core-1.1.3.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: javax/media/jai-core/1.1.3/jai-core-1.1.3.jar
[artifact:dependencies] Transferring 1856K
     [copy] Copying 1 file to C:\ant\lib
[artifact:dependencies] Downloading: com/sun/media/jai-codec/1.1.3/jai-codec-1.1.3.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: com/sun/media/jai-codec/1.1.3/jai-codec-1.1.3.jar
[artifact:dependencies] Transferring 252K
     [copy] Copying 1 file to C:\ant\lib

nonm2-macros:

init-no-m2:

init-cache:

-setup-temp-cache:
    [mkdir] Created dir: C:\Users\gerard\.ant\tempcache

-fetch-netrexx:

-fetch-netrexx-no-commons-net:
      [get] Getting: ftp://ftp.software.ibm.com/software/awdtools/netrexx/NetRexx.zip
      [get] To: C:\Users\gerard\.ant\tempcache\NetRexx.zip

netrexx:
     [copy] Copying 2 resources to C:\ant\lib

init-cache:

-cleanup-temp-cache:

all:

BUILD SUCCESSFUL
Total time: 38 seconds

Documentation / Reference


Powered by ComboStrap