Implement ant automatic compilation in eclipse

Source: Internet
Author: User
Tags netbeans

Many netbeans users are often proud of the advantages of compiling systems in their IDE, because this advantage is not available in eclipse. The compilation system in netbeans is completely ant-based. Each project has a compilation file, either automatically created by netbeans or manually created by developers. Unlike eclipse and intellij, the integration of netbeans and ant is completely seamless. Of course, this is both an advantage and a disadvantage. The focus is not on the benefits it brings to developers, but on the fact that most netbeans users and many eclipse developers think similar integration in eclipse is impossible. Switch ~~

Eclipse has long supported the standard project compiler. The aspectj plug-in is an example. In eclipse, aspectj overwrites the default Java compiler and replaces it with the aspectj compiler. It can also be based on externalProgramFor example, jikes or a customized compiler, or even ant, manually configure a project compiler. For simplicity, I will use the fuse project as an example to illustrate this problem. This example is only applicable in eclipse 3.2 M5. For versions earlier than 3.2 M5, eclipse cannot integrate the results of third-party compilers, parseSource codeAn error is reported, and the classnotfound compilation error is automatically displayed.

The following explains how to configure ant in eclipse. The first step is to open the project properties in the builders section, select the new button, and then select ant build in the pop-up dialog box.
 
Enter the name you want to give to the compiler in the Name field. Here, the name is "fuse ant builder ". Use the Browse workspace button to select the compiling file and project root directory (or any directory that you want the ant file to run ). Select the targets tag.
 
You may want to configure the clean and build objects in the ant script. In general, we call it clean and build. Clean can help you clear binary files and recompile the project, while build can help you compile the system. Make sure that the default compilation object has been cleared from the default compilation Object List, unless the default ant compilation object is clean and target. Once the configuration is complete, select OK.

Now eclipse will return to the compiler section of the project property box. The Java builder is not selected in the confirmation list. Select OK to submit the modification.
 
Now we have completed a complete ant-based project without any eclipse compilation. All ant output results are displayed in the console, just like a common ant compiler. Note: compile-on-save, a great feature in eclipse is not available in the ant compiler. After modifying the file, I didn't feel any bad Compilation speed. It's as good as working in netbeans!

Welcome to the survey on the status quo of programmer magazine on Consumer Day 3-15

Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 624950

Related Article

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.