Implement ANT automatic compilation in Eclipse

xiaoxiao2021-03-19  189

Many NetBeans users are often proud of compilating the system in my IDE, because this advantage is that Eclipse does not have. The compilation system in NetBeans is completely based on ANT. Every project has a compilation file, whether it is NetBeans automatically created, or developers manually created. Unlike Eclipse and Intellij, NetBeans and ANT integration are completely seamless. Of course, this is the advantage and disadvantages, and the focus is not that it brings the benefits of developers, but most of the NetBeans users and many Eclipse developers believe that similar integration in Eclipse is impossible. Cut ~~

Eclipse has long supported for standard project compilers. The AspectJ plugin is one of the examples. In Eclipse, AspectJ covers the default Java compiler, and replaced with the AspectJ compiler. Alternatively, a project compiler can be manually configured based on external programs such as JIKES or custom compilers, and even Ant, etc.. It is easy to see, I will explain this issue as an example of FUSE project. This example is only available in Eclipse 3.2 M5. For version earlier than 3.2 m5, Eclipse cannot integrate the results of a third-party compiler, and then report an error when the source code is parsed, and the compilation error of ClassNotfound is automatically displayed.

Let's explain how to configure ANT in Eclipse. The first step is to open the project properties in the Builders section, select the New button, then select Ant Build in the pop-up dialog. Enter the name you want to give the compiler in the Name field, which is "Fuse Ant Builder". Use the Browse Workspace button to select Compile Files and Project Root Catalogs (or any directory you want Ant files). Then select the Targets tab. Maybe you want to configure Clean and Build objects in the Ant script. In general, we call Clean and Build. Clean can help you clear the binary and recompile the project, and Build can help you compile the system. Confirm 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 completed, select OK.

Eclipse now returns the compiler section of the project properties box. Java Builder is not selected in the list. Select OK to submit a part of the modified. Now we have completed a completed Ant-based project without any Eclipse compilation participation. All Ant output results are present in the console, just like a normal ANT compiler. Note that compile-on-save, a great feature in Eclipse is not in the ANT compiler. After modifying the file, I didn't feel any problems with the compilation speed. Work like working in NetBeans!

Welcome to the status quo of 3.15 Consumer Day "Programmer" magazine

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

New Post(0)