Eclipse+maven Environment Configuration

Source: Internet
Author: User
Tags object model rar

Software 152 Tang Wei

1.1 Prepare the following compression packages

1.jdk1.7

Files: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

Files:maven-3.3.9.rar

4.maven Warehouse (can be downloaded from the Internet, but slow)

files:. M2.rar

1.2 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 is 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 only with E:\jee directory, not with JDK,tomcat , etc in other places

1.3 Settings

1. set the eclipse configuration file eclipse.ini, modify the virtual machine path, and in the -vmargs Before adding

-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, need to move to another disk, The steps are as follows:

(1) Modify Maven root directory ( E:\jee\maven-3.3.9 ) under the conf folder within the Setting.xml file, add a line:

<localRepository>e:\jee\.m2\repository</localRepository>

(2) Modify Eclipse in the maven Configuration

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 click on the " Reindex"button to update the index.

1.4 New maven Project

1. Select menu file-new-maven Project, tick "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

1.5 Configuration Items

1. 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 Web. Xmlis missing:

Expand directory src-main-webapp, create a new folder inside"web-inf", in the " web-inf"to create the 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>

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 such as:

3. Run the project

Choose Menu "run"-"run Configurations", set as:

4. view the results in the browser

Address bar Enter "http://localhost:9527/struts-test/" To view 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.