Section "Using Ant"

zhaozj2021-02-16  91

The use of Ant is such a simple, more complex build.xml's writing can refer to Ant's help documentation

Developing Games in Java is worth seeing, although many places are sometimes, but the focus will never miss it!

Apache Ant is a free Java-based build tool and can be downloaded from http://ant.apache.org. Because Ant is Java-based, Ant build files can be compiled on any platform. Also, Ant is integrated into many Java Ides, so you can get up and running quickly.

Ant Build Files Are XML Files, Usually Named Build.xml. Listing I.1 Contains An Example Build File.

Listing I.1 Sample Ant Build File (9CBS blog is not available in XML format text ... see below)

The Sample Ant File Almost Describes Itself. First, TWO Properties Are Created to Specify The Srcdir and deferred to use the $ {varname} syntax.

The Build File Contains Four Targets: Clean, Compile, Build, And Rebuild.

............................ ...

The Build Target Depends on The Compile Target, So Running The Build Target Automatical Runs The Compile Target First. The Build Target Packs All The Compiled Class Files Into a .jar file.

.

After You've Got Ant Installed, Just Open A Command Prompt in The Directory of The Build File and Type in The Target You Want To Execute, Like this:

Ant Compile

. This command loads the build.xml file in the current directory and executes the compile target If you were to name no target, as in the following, the build target is executed because it's defined to be the default target in the build file:

Ant

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

New Post(0)