Comment Apache Ant sur Mac OS X
Dans ce tutoriel, nous allons vous montrer comment installer Apache Ant sur Mac OSX.
Outils :
-
Apache Ant 1.9.4
-
Mac OSX Yosemite 10.10
Preinstalled Apache Ant?
Dans l'ancienne version de Mac, Apache Ant peut être déjà installé par défaut, vérifiez si Apache Ant est installé:
$ ant -v
2. L'extrait
Copiez le fichier gz téléchargé dans votre emplacement préféré, extrayez-le.
$ cp ~/Downloads/apache-ant-1.9.4-bin.tar.gz . $ cd ~ $ pwd /Users/example $ tar vxf apache-ant-1.9.4-bin.tar.gz x apache-ant-1.9.4/bin/ant x apache-ant-1.9.4/bin/antRun x apache-ant-1.9.4/bin/antRun.pl x apache-ant-1.9.4/bin/complete-ant-cmd.pl x apache-ant-1.9.4/bin/runant.pl x apache-ant-1.9.4/bin/runant.py x apache-ant-1.9.4/ x apache-ant-1.9.4/bin/ ...... $ cd ~/apache-ant-1.9.4/bin $ pwd /Users/example/apache-ant-1.9.4/bin $ ant -v Apache Ant(TM) version 1.9.4 compiled on April 29 2014 Trying the default build file: build.xml Buildfile: build.xml does not exist! Build failed
P.S The Apache Ant commands are available at folder $APACHE_ANT_FOLDER/bin
.
3. Variable d'environnement
Définissez la commandeant
comme variable d'environnement, afin que vous puissiez «ant» construire votre projet partout.
$ vim ~/.bash_profile
Exporte$ANT_HOME/bin
, enregistre et redémarre le terminal.
~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home) export GRADLE_HOME=/Users/example/gradle export M2_HOME=/Users/example/apache-maven-3.1.1 # Apache Ant export ANT_HOME=/Users/example/apache-ant-1.9.4 # Export to PATH export PATH=$PATH:$GRADLE_HOME/bin:$M2_HOME/bin:$ANT_HOME/bin
Testez-le à nouveau, maintenant, vous pouvez accéder à la commandeant
partout.
$ cd ~ $ pwd /Users/example $ ant -v Apache Ant(TM) version 1.9.4 compiled on April 29 2014 Trying the default build file: build.xml Buildfile: build.xml does not exist! Build failed
Terminé.