First, prepare the following compression package
1.jdk1.7
Files: Jdk1.7.rar
2. Eclipse-jee-mars-2
Files: 32-bit System preparation eclipse-jee-mars-2-win32.zip,64-bit system Preparation eclipse-jee-mars-2-win32-x86_64.zip
3.maven
Files: Maven-3.3.9.rar
4.maven Warehouse (can be downloaded from the Internet, but slow)
Files:. m2.rar
Second, installation (decompression)
1. Select a working disk, such as e: Disk, to set up a directory Jee
2. Place the compressed package in the JEE directory and unzip the
JDK root directory is E:\jee\jdk1.7
Eclipse root directory for e:\jee\eclipse,eclipse working directory is E:\jee\workspace
Maven root directory is E:\jee\maven-3.3.9
Maven Repository root directory is E:\jee\.m2
Note: After all the development process is only related to the E:\jee directory, not with other local JDK, Tomcat and other sex
Third, set
1. Set the Eclipse profile Eclipse.ini, modify the virtual machine path, and add it before-vmargs
-VM E:\jee\jdk1.7\bin\javaw.exe
Note: Open the changes with WordPad,-VM do not break the line
2. Start eclipse, set up maven
Search for "maven" in the menu window-prefrences, open the "Installations" option to set
3. Set the MAVEN local warehouse path
Maven local warehouse By default under C:\Users\ username \.m2, c disk space is usually very tense and needs to be moved to another disk, the steps are as follows:
(1) Modify the Setting.xml file in the Conf folder under the MAVEN root directory (E:\jee\maven-3.3.9) and add a new line:
<localRepository>e:\jee\.m2\repository</localRepository>
(2) Modifying the MAVEN configuration in eclipse
In the menu window--prefrences, open "Maven--user settings", such as:
Click the "Browse ..." button on the "User settings" setting, select the Maven profile, and then click the "Reindex" button below to update the index.
Iv. New MAVEN Project
1. Select the menu File-new-maven project and tick the "Create a &simple project (skip archetype selection)" Entry:
2. Create a new MAVEN project and set the project properties as follows
3. Click the Finish button to complete the creation
V. Configuration Items
1. Add Web. xml
The most important configuration file for the MAVEN project is that Pom.xml,pom is the "project object Model" meaning. There is now a bug in Pom.xml that indicates that Web. XML is missing:
Expand the directory Src-main-webapp, create a new folder "Web-inf" in the box, and in "Web-inf" you are creating Web. Xml.
The Web. Xml reads as follows:
<?xml version= "1.0" encoding= "UTF-8"?>
<web-app>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
It defines the name of the page and gives the page processing to struts.
2. Add the WebApp directory to Java resources for unified management
Right-click on the item and select "Build Path" in the "Source" tab, "Add Folder", select as:
3. Run the project
Choose Menu "Run"-"Run Configurations", set as:
Then check the login URL http://localhost:9527/struts-test/.
Java EE Configuration Tool