[Ant] A very simple ant use tutorial

Source: Internet
Author: User

A common way for a project directory:

MyProject <dir>
|--lib <dir>--Library Directory
|--classes <dir>--Destination file directory
|--SRC <dir>--Source Files directory
|--doc <dir>--API Documents Directory
|--build.xml

In this way, you can throw the desired. jar file into the Lib directory, and then if you are lazy like me, you can compile it with the following build.xml.
----------
<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>
----------

Description
The first paragraph defines the path p and joins all. jar files under Lib.
The second paragraph calls Javac, specifies that classpath is the previously defined p, compiles all the. java files under the SRC directory, and then puts the. class file into the classes directory after success.

How to run Ant:
Open the Command Line window, enter the directory where Build.xml is located, and enter Ant

For more information, please refer to
http://ant.apache.org download Ant and unzip it, open ant/docs/index.html, select Manual->ant tasks->core tasks in the menu to learn the usage of the other core task

After you download Ant and unzip it, open ant/docs/index.html and select Manual->ant tasks->core tasks in the menu to learn the usage of the other core task

trackback:http://tb.blog.csdn.net/trackback.aspx?postid=305559

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.