JAKARTA-ANT (Java Compilation Tool)

xiaoxiao2021-03-06  20

One: Introduction:

Ant is a compilation tool for Jakarta if you know the makefile under Linux / Unix you are easy.

Understand the use of Ant. Ant is best for you to write a Java program using UltraEdit (editplus), then you use Ant to compile, and Javadoc generates a JAR, WAR, and Copy, which can realize files can be implemented in build.xml through different TAGER, or very convenient A stylish recommendation is used.

2: Download

You can download it 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: Unfailed the file you downloaded, there will be a Jakarta-Ant (version number) directory generated, rename him to Ant

2: Copy Ant directory to the location you need.

3: Add: Ant_Home = Ant installation directory, Path plus $ ANT_HOME $ / in; note that you must have JDK installed, add Java_Home environment variable, and add $ JAVA_HOME $. / in;

B: Linux / UNIX

1: Unfailed the file you downloaded, there will be a Jakarta-Ant (version number) directory generated, rename him to Ant

2: Copy Ant directory to the location you need.

3: Add: Ant_Home = Ant installation directory, Path plus $ ANT_HOME $ / in; note that you must have JDK installed, add Java_Home environment variable, and add $ JAVA_HOME $. / in; Implement a modified 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

Four: Write Build.xml

Build.xml is equivalent to Makefile under Linux, and the specific implementation is implemented in build.xml.

I give an example to explain it.

Build.xml

============================================================================================================================================================================================================= ==============

Building ...

destdir = "$ {javac.dest}"

Classpath = "$ {classpath}"

Debug = "on" />

FILTERING = "true" />

Manifest = "$ {jar.dest} /manifest.mf"

/>

destdir = "$ {javadoc.dest}"

Classpath = "$ {classpath}"

PackageNames = "$ {packagelist}"

Version = "True"

protected = "true"

Author = "True"

Use = "true"

WINDOWTITLE = "Bingo Free Java Code Version $ {Version}"

Header = "Bingo Free Java Code $ {Version}"

/>

转载请注明原文地址:https://www.9cbs.com/read-43706.html

New Post(0)