How to implement Ant's Web project modification after saving in Eclipse, real-time deployment, direct refresh to see the results

Source: Internet
Author: User

Recently encountered an old project, is Ant's Web project, after the project was imported into eclipse, found that after modifying the file, the first to execute the Build.xml, and then put the packaged war into Tomcat, and then refresh to see the effect. Since Ant has not been used before, I have researched a set of methods (if Ant does have a method that can see the result as soon as it is modified under Eclipse, we also hope that Sir will not hesitate to enlighten me).

This project references the following 4 posts:

Posts 1:http://blog.csdn.net/futurelight/article/details/624950

Posts 2:http://wenku.baidu.com/view/5aa83ac46137ee06eff918ac.html

Post 3: How to set up Tomcat remote debugging (Cannot find the original address, please the author forgive Me *_*)

Posts 4:http://www.67tgb.com/?p=414


In fact, the essence of this set of processes is as follows:

1. Modify Eclipse's default configuration, modify the default builders of the current project to Ant, and match Eclipse's project--build automatically to ensure that each save will automatically call ant for compilation (see post 1 for details) ;

2. In the compiled results, the files that Tomcat needs are copied to a directory (see post 2, and check the ant manual or Google Niang);

3. Complete the project deployment using TOMCAT remote deployment (that is, adding a profile implementation under the <%tomcat%>/conf/catalina/localhost directory) (see post 2);

4. Refresh the browser to see the results change;

5. Eclipse remote Monitoring, debugging.


The details above can be found in posts 1, 2, and the following are some details:

a). The 1th step compiles with the hint "javax.servlet.http package not Found" and copies the Tomcat\common\lib\servlet-api.jar to the Jdk\jre\lib\ext directory.

b). The 2nd step when copying a file, if you do not know the structure of the file after copying, you can make the project into a war, and the deployment of the folder structure after decompression remains the same.

c). The 2nd step to copy the file, because the Lib package does not usually change, it is recommended to separate LIB copy, unless the reference lib changes, otherwise do not execute, this can save time.

d). The 3rd step is supported by remote deployment of the Web container, and my own use of Tomcat is relatively straightforward. If you switch to a different container, you need the support of the container itself, or you can directly copy the relevant file to the specified directory in the other container directly at step 2nd.

e). In the 5th step, debugging requires remote debugging, which needs to be configured separately for Tomcat and Eclipse. Tomcat is set up by adding a line before the end of the Start.bat (call "%executable%" start%cmd_line_args%) with the following: set JAVA_OPTS=-XDEBUG-XRUNJDWP: Transport=dt_socket,address=8000,server=y,suspend=n. The address=8000 here is the port to listen to later. Eclipse Configuration remote monitoring is relatively simple, using the debug Configurations--remote Java application A new configuration, select the project, with the host, port (8000 above). Start Tomcat, start Debug, and start debugging.

f). In the 5th step, when debugging is easy to appear "Unable to install breakpoint due to the missing line number" error, in the reference post 4 has the very detailed solution, modifies can.

g). The 5th step, when using Tomcat debugging, do not use the eclipse built-in server, will be prompted to find a project (404 error), it is recommended to find an Eclipse Tomcat plug-in, use this plugin to start Tomcat.


Disadvantages:

a). The auto-execute ant script after save is implemented by Eclipse's own project--build automatically, which can be slow when the project is large, which is determined by your own test.

b). Since Ant has a large flexibility and does not require a directory structure like maven, put similar files together when planning the project directory structure, otherwise the statements to be written by copy will be very cumbersome (spit out the old project I maintained, more than 10 configuration files seven or eight place, Even if it was his own original integration statement, wrote a bunch of why you didn't put the configuration file together at that time.


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.