Home | Mirror | Search

2. Build Tools

2.1. Apache Ant

http://ant.apache.org/

cd /usr/local/src
wget http://mirror.bjtu.edu.cn/apache//ant/binaries/apache-ant-1.8.1-bin.tar.gz
tar zxvf apache-ant-1.8.1-bin.tar.gz
mv apache-ant-1.8.1 /usr/local/
cd ..
ln -s apache-ant-1.8.1 apache-ant
	
ANT_HOME=/usr/local/apache-ant
export CLASSPATH=$CLASSPATH:$ANT_HOME/lib
	

2.2. Apache Ivy

http://ant.apache.org/ivy/index.html

2.2.1. Ivy Install

2.2.1.1. source code
cd /usr/local/src
wget http://labs.renren.com/apache-mirror//ant/ivy/2.2.0/apache-ivy-2.2.0-bin.tar.gz
tar zxvf apache-ivy-2.2.0-bin.tar.gz
mv apache-ivy-2.2.0 /usr/local/
cd ..
ln -s apache-ivy-2.2.0 apache-ivy
			
IVY_HOME=/usr/local/apache-ivy
			
cp $IVY_HOME/ivy-2.2.0.jar $ANT_HOME/lib/
			
2.2.1.2. apt-get
$ sudo apt-get install ant
$ sudo apt-get install ivy
			

To know more about this package, you can use dpkg

$ dpkg -s ivy
			

2.2.2. Test example

ant

cd $IVY_HOME/src/example/hello-ivy
ant

Buildfile: /usr/local/apache-ivy-2.2.0/src/example/hello-ivy/build.xml

resolve:
[ivy:retrieve] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: url = jar:file:/usr/local/apache-ant/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: org.apache#hello-ivy;working@example.com
[ivy:retrieve]  confs: [default]
[ivy:retrieve]  found commons-lang#commons-lang;2.0 in public
[ivy:retrieve]  found commons-cli#commons-cli;1.0 in public
[ivy:retrieve]  found commons-logging#commons-logging;1.0 in public
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-lang/commons-lang/2.0/commons-lang-2.0.jar ...
[ivy:retrieve] .......................................................................................
[ivy:retrieve] ..................................................................................................................................................................
[ivy:retrieve] ........................................................................................... (165kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-lang#commons-lang;2.0!commons-lang.jar (4790ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-lang/commons-lang/2.0/commons-lang-2.0-javadoc.jar ...
[ivy:retrieve] ................................................................................................................
[ivy:retrieve] .........................................
[ivy:retrieve] ..................................................
[ivy:retrieve] .....................................................
[ivy:retrieve] ..................................................................................................................................
[ivy:retrieve] ..................................................................................................................................
[ivy:retrieve] .................................................................................................................
[ivy:retrieve] ...........................................................................................................................................................................
[ivy:retrieve] .............................................................................................................................................................................................. (467kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-lang#commons-lang;2.0!commons-lang.jar(javadoc) (14878ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-lang/commons-lang/2.0/commons-lang-2.0-sources.jar ...
[ivy:retrieve] ...........................................................................................................................................................................
[ivy:retrieve] ................................................................................................................................................................................................................
[ivy:retrieve] .............................................................................................................................................. (245kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-lang#commons-lang;2.0!commons-lang.jar(source) (5046ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-cli/commons-cli/1.0/commons-cli-1.0-javadoc.jar ...
[ivy:retrieve] ....................................................................................................................................................
[ivy:retrieve] ...................................... (92kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-cli#commons-cli;1.0!commons-cli.jar(javadoc) (2838ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-cli/commons-cli/1.0/commons-cli-1.0.jar ...
[ivy:retrieve] ......................................................... (29kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-cli#commons-cli;1.0!commons-cli.jar (5147ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-cli/commons-cli/1.0/commons-cli-1.0-sources.jar ...
[ivy:retrieve] ...................................................................................................... (48kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-cli#commons-cli;1.0!commons-cli.jar(source) (2163ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-logging/commons-logging/1.0/commons-logging-1.0.jar ...
[ivy:retrieve] ............................................ (21kB)
[ivy:retrieve] ... (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-logging#commons-logging;1.0!commons-logging.jar (2638ms)
[ivy:retrieve] :: resolution report :: resolve 30806ms :: artifacts dl 37511ms
[ivy:retrieve]  :: evicted modules:
[ivy:retrieve]  commons-lang#commons-lang;1.0 by [commons-lang#commons-lang;2.0] in [default]
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |      default     |   4   |   3   |   3   |   1   ||   7   |   7   |
        ---------------------------------------------------------------------
[ivy:retrieve] :: retrieving :: org.apache#hello-ivy
[ivy:retrieve]  confs: [default]
[ivy:retrieve]  7 artifacts copied, 0 already retrieved (1069kB/11ms)

run:
    [mkdir] Created dir: /usr/local/apache-ivy-2.2.0/src/example/hello-ivy/build
    [javac] /usr/local/apache-ivy-2.2.0/src/example/hello-ivy/build.xml:53: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 1 source file to /usr/local/apache-ivy-2.2.0/src/example/hello-ivy/build
     [java] standard message : hello ivy !
     [java] capitalized by org.apache.commons.lang.WordUtils : Hello Ivy !

BUILD SUCCESSFUL
Total time: 1 second

		

run it

neo@debian:/usr/local/apache-ivy/src/example/hello-ivy/build$ export CLASSPATH=$CLASSPATH:/usr/local/apache-ivy/src/example/hello-ivy/lib/*
neo@debian:/usr/local/apache-ivy/src/example/hello-ivy/build$ /usr/local/java/bin/java example.Hello
standard message : hello ivy !
capitalized by org.apache.commons.lang.WordUtils : Hello Ivy !
		

2.3. maven2

$ sudo apt-get install maven2

$ mvn -version
Apache Maven 2.2.1 (rdebian-4)
Java version: 1.6.0_22
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.38-8-generic" arch: "amd64" Family: "unix"

	
JAVA_HOME="/usr/lib/jvm/java-6-openjdk/jre"
MAVEN_HOME="/usr/share/maven2/"
			
comments powered by Disqus