Automation integration in Java
Javayangjoke 2004.06.28
Overview
Projects are inseparable from the beginning to the end to re-repeat various steps to achieve unit testing, integration testing, especially n-layer web applications, below I continued to integrate in Java web program development.
1, Ant (http://ant.apache.org/)
Ant is an open source project in Apache, is a fairly simple build tool.
l installation
N to http://ant.apache.org/bindownload.cgi download
n Decompress the downloaded file, set the environment variable in the operating system (ANT_HOME = $ {Ant_Home})
n and add path = path in PATH; Ant_Home / Bin
l
n Write a build.xml file (see below).
N Run Ant -f Build.xml in the CMD window
A simple build.xml file
XML Version = "1.0" encoding = "ISO-8859-1">
<-! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ ->
A simple example
Java:
Package com.Alt.gzcx.action;
import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; / ** * @ Web.Servlet * name = "filedownloadaction" * display-name = "file download action" * description = "file download action" * load-on-startup = "1" * * @ web.servlet-mapping * URL-PATTERN = "file / filedownloadaction" * /
public class FileDownloadAction extends HttpServlet {public void init (ServletConfig config) throws ServletException {} public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {}}
Xml Version = "1.0" encoding = "ISO-8859-1"?>
"2.3" destdir = "$ {web.Web-infm}"> deploymentDescriptor> webdoclet> target> project> ant -f xdoclet.xml can be generated.