Apache Ant Là Gì

     

Apache Ant is a tool for building Java projects. In the old days, when working at my old company, I always used it. But now, it is less used because of Apache Maven. In this tutorial, I will guide you how lớn copy a tệp tin using Apache Ant.

Bạn đang xem: Apache ant là gì

I will create a Java project as an example:

*

Next, I will create an XML tệp tin to work with Apache Ant. You can name this file by any name. But when you name it to build.xml, Eclipse will understand it is the file using Apache Ant to run. In this tutorial, I will name it to build.xml.

*

And I will copy a tệp tin named example.txt in the project directory lớn the src directory.

Xem thêm: Bộ Sưu Tập 16 Bài Thơ Kỷ Niệm 10 Năm Ngày Cưới Lãng Mạn Và Hạnh Phúc

*

We will use Apache Ant’s copy task khổng lồ copy. The contents of the build.xml tệp tin will look like this:


XHTML
1
2
3
4
5
6
basedir="." default="copy-file">
name="copy-file">
file="example.txt" todir="src" />
Notice the line:


XHTML
1
file="example.txt" todir="src" />

This is a copy task of Apache Ant in which the tệp tin attribute is the filename lớn copy, while the todir attribute is the directory path that will contain the file after the copy.

Now, right-click on the build.xml file, select Run as then Ant build, và we’ll get the following output:

*

And:

*


Previous Post: Bean inheritance in Spring
Next Post: Convert InputStream to ByteArray using Apache Commons IO

Add phản hồi Cancel reply


Name (required)
Email (required)
Website (optional)

Submit Comment

Search Google


*
report this ad


Announcement


Most Viewed


Recent Comments


Links


Theme: GoMedia by ThemeJunkie. Back to Top
Insert/edit linkClose

Enter the destination URL


URL
Link Text
mở cửa link in a new tab

Or links to existing content


Search
No tìm kiếm term specified. Showing recent items.

Xem thêm: Đáp Án Game Đố Vui Dân Gian Từ Câu 161, 100+ Câu Đố Vui Về Con Vật Kèm Đáp Án

Search or use up and down arrow keys to select an item.
Cancel
x
x