Software 151 Zhu Real friends
(1)JDK1.7
file:jdk1.7.rar.
(2)eclipse-jee-mars-2
Document:system preparation eclipse-jee-mars-2-win32.zip, System Preparation Eclipse-jee-mars-2-win32-x86_64.zip.
(3)maven
file:maven-3.3.9.rar.
(4)maven repository (can be downloaded from the Internet, but slow)
files:. M2.rar.
① Select a working disk, such as E: disk, to establish the directory Jee.
② the compressed package into the JEE directory and unzip it.
the JDK root directory is E:\jee\jdk1.7.
Eclipse root directory is E:\jee\eclipse,Eclipse working directory is E:\jee\workspace .
the Maven root directory is E:\jee\maven-3.3.9.
the Maven repository root directory is E:\jee\.m2.
Note: After all the development process only with E:\jee directory, not with JDK,Tomcat in other places
Wait for sex.
(5) setting up Eclipse configuration file Eclipse.ini
Modify the virtual machine path to add -vm E:\jee\jdk1.7\bin\javaw.exebefore-vmargs.
Note: Open the changes with WordPad,-vm do not wrap.
(6) Start Eclipse, set up maven
search for "maven" in the menu window-prefrences, open the "installations" option to
Set up.
(7) setting the maven local warehouse path
Maven Local Warehouse by default under C:\Users\ username \.m2 ,C disk space is usually very tense, need to move to another disk, The steps are as follows:
① Modify the Conf folder in the Maven root directory (E:\jee\maven-3.3.9) Setting.xml
File, add a line:
<localRepository>e:\jee\.m2\repository</localRepository>
② modifying the maven configuration in Eclipse
in the menu window--prefrences , open "maven--user settings"
Click the "Browse..." button on the "User settings" Setting, select the maven profile and click on the " Reindex"button to update the index.
Select Menu file-new-maven Project, tick "Create A & Simple Project (skip archetype selection)"Item
Create a new maven project, set project Properties
Click the Finish button to complete the creation.
③ Add Web. xml
The most important configuration file for the Maven project is pom.xml,which means that thePom is the "Project object Model".
There is now a bug in Pom.xml that indicates that the Web. XML is missing
Expand directory src-main-webapp, create a new folder inside"web-inf", in the " web-inf"Creating Web. Xml in
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.
④ Adding the WebApp directory to Java Resources Unified Management
Right-click on the item, select "Build Path" andclick "Add Folder" on theSourcetab.
⑤ running the project
Select Menu "run"-"run configurations"
⑥ viewing results in a browser
Enter "http://localhost:9527/struts-test/" in the address bar toview the results.
Eclipse+maven Environment Configuration