Build a Java EE project with maven

Source: Internet
Author: User

First, the development environment

jdk1.7 TOMCAT7 Eclipse-jee-luna-r-win32 maven2.2.1

Two building steps

1. Click File->new->other to select Maven Project


2. Select Maven Project, click Next, and then click Next to enter the following screen


Select the last one and click Next

3. See the following interface


Enter the group ID and artifact ID, click Finish to complete the basic creation

4. Create a good project structure (Java view)


If it is a Java EE view, the project structure you see is not like this, you can change to Java view as follows


5. Right-click the project->build path->configure Build Path. Enter the following interface



There is a mouse click to select the right side of the Red fork, click Remove Delete, click OK to save

6. Add source folder to create a standard MAVEN Web project structure

Right-click the project->new->source folder-> fill in the Folder name,


Add Src/main/java Src/test/java src/test/resources in turn (Src/main/resources already exists)

7. New Project Structure


8. Configure the output path

Right-click the project->build path->configure Build Path. Enter the following interface


Mouse selected Src/test/java,src/test/resources, click Edit, change the output directory is: Testdemo02/target/test-class (Testdemo for my project name)

Select if browse has this directory, otherwise manually enter Testdemo02/target/test-class

8. Update the relevant version

Right-click on the project->properties->project Facets, change the JDK to the locally installed version, my 1.7;dynamic Web modul cannot be changed here


Locate the project location, change the Org.eclipse.wst.common.project.facet.core.xml file under the. setting file, change the line configuration <installed facet= "Jst.web" version = "2.3"/> change version to 3.0

Update the project in Eclipse, right-click the project->properties->project Facets again, and you see that the dynamic Web Modul has been changed to 3.0

9. Set the Deployment Program collection

Right-click the project->properties->deployment Assembly.

Delete Test two items because test is used for testing and does not need to be deployed;

Add Maven dependency; Add->java Build Path Entires->maven dependencies->finish

The interface to complete the setup is as follows


10. Add dependent dependencies in Pom.xml, update maven project

11. Add the Tomcat server to eclipse, add the project to the server, start Tomcat, and then visit the project http://localhost:8080/testDemo02/to see the familiar interface.

Build a Java EE project with maven

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.