[Ant] Very simple ant tutorial

Source: Internet
Author: User

Common methods for creating a project directory:

Myproject <dir>
| -- Lib <dir> -- library directory
| -- Classes <dir> -- target file directory
| -- SRC <dir> -- source file directory
| -- Doc <dir> -- API document directory
| -- Build. xml

In this way, you can leave the desired. jar file to the lib directory, and use the build. xml below to compile it if you are as lazy as I do.
----------
<Project name = "" basedir = "./" default = "C">
<Path id = "p">
<Fileset dir = "lib/">
<Include name = "**/*. Jar"/>
</Fileset>
</Path>

<Target name = "C" depends = "">
<Javac srcdir = "src" destdir = "classes" classpathref = "p"/>
</Target>
</Project>
----------

Note:
The first section defines the path P and Adds all. Jar files under Lib.
The second section calls javac and specifies the classpath as the P defined earlier. compile all. java files in the src directory and put the. Class file into the classes directory.

How to run ant:
Open the command line window, enter the directory where build. XML is located, and enter ant

For more information, see
After the http://ant.apache.org downloads ant and decompress it, open ANT/docs/index.html, and choose manual-> ant tasks-> core tasks from the menu to learn how to use other core tasks

Download ant and decompress it. Open ANT/docs/index.html and choose manual> ant tasks> core tasks from the menu to learn how to use other core tasks.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.