Eclipse+maven Environment Configuration

Source: Internet
Author: User
Tags object model

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

Related Article

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.