Compile One: Introduction:
Ant is a compilation tool for Jakarta, and if you understand the makefile under Linux/unix you'll be very easy to
Understand the use of ant. Ant is best for you to use UltraEdit (EditPlus) to write Java programs, and then you use ant to compile, and Javadoc, to generate a Jar,war, The implementation of the file copy can be in Build.xml through different tager to achieve, or very convenient one Dongdong strongly recommended is to use.
Two: Download
You can download from the address below to ant, current version: 1.41
http://jakarta.apache.org/builds/jakarta-ant/release/v1.4.1/bin/
Three: Installation
A:) Windows
1: Unzip the file you downloaded, there will be a jakarta-ant (version number) directory generated, renamed him Ant
2:copy ant directory to the location you want.
3: Add in environment variable: Ant_home=ant installation directory, add $ant_home$\in in path; Note that you must also have the JDK installed and add the JAVA_HOME environment variable, plus $java_home$\in in the early path;
B:) Linux/unix
1: Unzip the file you downloaded, there will be a jakarta-ant (version number) directory generated, renamed him Ant
2:copy ant directory to the location you want.
3: Add in environment variable: Ant_home=ant installation directory, add $ant_home$\in in path; Note that you must also have the JDK installed and add the JAVA_HOME environment variable, plus $java_home$\in in the early path; Implement modify environment variable you need to modify the. bash_profile file.
As follows
Ant_home=/usr/local/ant
Java_home=/usr/local/jdk
Path= $PATH: $HOME/bin:/usr/local/ant/bin:/usr/local/jdk/bin
Export PATH ant_home Java_home
IV: Writing Build.xml
Build.xml rather Linux under the makefile, the implementation of the specific in Build.xml.
Let me give an example to illustrate.
Build.xml
================================================================
<project name= "Bingo" default= "Build" basedir= ". /.. ">
<!--basedir set working directory-->
<property name= "Version" value= "1.0"/>
<!--the base directory relative to which most targets are built-->
<property name= "base" value= "." />
<!--the directory where source files are stored. -->
<property name= "Java.source.dir" value= "Bingo/src"/>
<!--code save path-->
<!--destination for compiled files-->
<property name= "Javac.dest" value= "bingo/classes"/>
<!--class Save path-->
<!--destination for generated jar files-->
<property name= "Jar.dest" value= "Bingo/jar"/>
<!--jar File save path-->
<!--destination for documentation files generated or not-->
<property name= "Docs" value= "Bingo/docs"/>
<!--Javadoc File save path-->
<!--destination for Javadoc generated files-->
<property name= "Javadoc.dest" value= "Bingo/docs"/>
<!--the stem where most log4j source code is located. -->
<property name= "stem" value= "Com/bingo"/>
<!--List all Package used in this project-->
<property name= "Packagelist" value= "
Com.bingo,
Com.bingo.database,
COM.BINGO.DBOCW,
Com.bingo.util,
Com.bingo.taglibs.jndi,
Com.bingo.finance.database,
Com.bingo.finance.entity,
Com.bingo.finance.manager "
/>
<!--all the packages in your project-->
<!--List all jars or file used in this project-->
<property name= "Classpath" value= "${classpath}";
${base-files}/tomcat/servlet.jar;
${base-files}/tomcat/webserver.jar;
${base-files}/log4j/log4j.jar;
${base-files}/log4j/log4j-core.jar "
/>
<!--you need to use the bag-->
<target name= "Init" >
<tstamp/>
</target>
<target name= "Build" depends= "init" >
<echo>
Building ...
</echo>
<!--=================================================================-->
<!--Remove The temporary manifest file, actual work is do in the-->
<!--dependencies. -->
<!--=================================================================-->
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.