One, MyEclipse Web project Deployment (release) process Web project deployment (release) process 2008-01-18 14:35
Create a new Web project ABC under MyEclipse. The system settings default to the following:
Project Save location: Workspace directory \abc
SOURCE folder: SRC, which holds all Java class files (. java files) and XML files.
Web root folder: WebRoot, save all JSP files, including CSS, JavaScript, and so on. The included Web-inf folder has a very important role to play!
Context Root URL:/ABC. /number points to the previous layer,/ABC points to this directory.
The project folder contains a total of 6 files and folders:
. MyEclipse Folder
src folder
Webroot Folder
Files that are included in the sibling:
. classpath file
. mymetadata File
. project file
Deploying (Deploy) projects in MyEclipse
In the case of project name ABC, the published location defaults to the ABC directory under the WebApps directory in the Tomcat installation directory.
Generally think: Tomcat\webapps\abc directory is full copy myeclipse\workspace\abc\webroot\ inside all content.
The process of deployment is to copy the contents of the MyEclipse Webroot into Tomcat webapps\abc, and then restart Tomcat.
The Webroot directory contains index.jsp.
When a user accesses the web, the input http://localhost:8080/abc points to the index.jsp in the TOMCAT\WEBAPPS\ABC directory
can be accessed normally!
The composition of Webroot:
Webroot\web-inf\classes directory is very interesting!
The workspace\abc\webroot\web-inf\classes directory corresponds to the WORKSPACE\ABC\SRC directory one by one! All the. class files after compilation are saved here, and the deployment will only expose bytecode, and Java files remain in the development platform.
SRC directory for Java class files (. java)
The classes directory is a bytecode file (. Class)
C:\AAAA\I_SALES\SRC and C:\AAAA\i_sales\WebRoot\WEB-INF\classes
The structure inside is identical and the file name is exactly the same. Just put all the extensions. Java into. class.
Summarize:
1, Webroot folder can be external to the finished product! Copy to Tomcat bearer.
2, SRC directory is a heavyweight Java program, compiled will be put into Webroot.
3, JSP page, JavaScript, CSS directly written in the Webroot. Organize your own directory structure, easy to classify and manage.
Ii. deployment of the Eclipse Web project
... Tomcat\conf\catalina\localhost\tracker.xml <context path= "/tracker" reloadable= "true" docBase= "D:\web\tracker" Workdir= "D:\web\tracker\work"
Third, Eclipse+tomcat+ant
1. Open Eclipse and build the Builds.xml file under the project's root path.
This is the key to ant configuration. The contents are as follows:
-----------------
<?xml version= "1.0"?>
<project name= "Webmodulebuilder" default= "Deploy" basedir= "." >
<!--set global properties for this build--
<!--publishing a Web path--
<property name= "Deploy_path" value= "D:/tomcat 5.0/webapps/dt"/>
<!--source Web path--
<property name= "Web_path" value= "D:/eclipse/workspace/test/dt"/>
<!--source-compiled jar package path--
<property name= "Jar_path" value= "D:/eclipse/workspace/test/dt/web-inf/lib"/>
<!--source Java file path--
<property name= "Scr_path" value= "D:/eclipse/workspace/test/src"/>
<!--source class file path--
<property name= "Class_path" value= "d:/eclipse/workspace/test/dt/web-inf/classes"/>
<!--definition Classpath--
<path id= "Lib_class_path" >
<fileset file= "${jar_path}/*.jar"/>
<pathelement path= "${class_path}"/>
</path>
<!--initial
<target name= "Init" >
<mkdir dir= "${deploy_path}"/>
<mkdir dir= "${deploy_path}/web-inf"/>
<mkdir dir= "${deploy_path}/web-inf/classes"/>
<mkdir dir= "${deploy_path}/web-inf/lib"/>
</target>
<!--compiled Class--
<target name= "Compile" depends= "init" description= "compile the source files" >
<mkdir dir= "${class_path}"/>
<javac srcdir= "${scr_path}" destdir= "${class_path}" >
<classpath refid= "Lib_class_path"/>
</javac>
</target>
<!--copy Release--
<target name= "Deploy" depends= "Init,compile" >
<copy todir= "${deploy_path}" >
<fileset dir= "${web_path}" >
<include name= "**/*.*"/>
<exclude name= "**/jsp_servlet/*.class"/>
<exclude name= "**/build.xml"/>
<exclude name= "**/deploy.xml"/>
<exclude name= "**/build.properties"/>
<exclude name= "**/servers.xml"/>
<exclude name= "**/targets.xml"/>
<exclude name= "**/*.war"/>
</fileset>
</copy>
</target>
</project>
-----------------
2. Right-click the project and select "Properties-builder". then click New.
3. In the Select Configuration Type window, click to select Ant Build, and click OK.
4. Configure the builder's properties and fill in the name of the builder.
In the "Main" page box, "Build File" selects the configuration Builds.xml, "Basic directory" to select the root directory of the project.
Build options, tick "during auto-build".
5. Click "OK" to complete the configuration.
6. Tick the "builder" in the project properties and uncheck "Java Builder" by ticking the ant builder you just created. Click OK.
7. When the system is debugged, Ant automatically compiles and publishes the file to the specified directory. Cool!
MyEclipse Web project deployment differences with Eclipse