Eclipse Create MAVEN Web project

Source: Internet
Author: User
Tags sonatype

1. First confirm that your eclipse is installed in the M2ECLIPSE environment, you can refer to the two Maven learning content

2. Create a new MAVEN project

3. Next default configuration, use the default workspace, or you can choose a different space for yourself

4. Generally we are web development, so choose Maven-archetype-webapp

5. Fill in the appropriate groupid,artifactid,version and other information

MAVEN Coordinates: groupId:artifactId:packaging:version

GroupId
Groups, companies, groups, organizations, projects, or other groups. The Convention for the Community identity is that it starts with the reverse domain name (reverse domain name) that creates the organization name for the project.
The project from Sonatype has a groupid that begins with Com.sonatype, and the Apache software project has org.apache that begins with GroupID.

Artifactid
A unique identifier that represents a single item under GroupID. (That is, the project name of Eclipse)
Version
A specific version of a project. A published project has a fixed version identity that points to a specific version of the project. and the project under development can use a special logo,
This designation adds a "SNAPSHOT" tag to the version.
Packaging
The type of project, by default, is the jar, which describes the output after the project is packaged. A project of type jar produces a jar file, and a project of type War produces a Web application. (not reflected in elipse after input)

6. The following projects have been completed:


7. This is just a MAVEN Web project that cannot be published in Tomcat in the eclipse environment, so we convert it to a Web project supported by Eclipse.
Right Preferences----->project facets Click on the link on the right

As you can see, not a Dynamic Web project, Java version is 1.6

Next, we select the dynamic WEB module tick, note that the right version is 3.0 to use, we use a lower version of TOMCAT7,
Choose 2.5, Support TOMCAT6, Java version can be used according to their own projects, I generally use the 1.6 version of the JDK, so choose 1.6 version

See at the bottom there is a link, click inside, default is WebContent

We generally according to the MAVEN project directory structure Convention, we adopt this set Src/main/webapp directory for our JSP and other files of the storage path

Here, a project with MAVEN dependencies has been completed. Next, we follow some conventions to standardize the development and testing of our programs.

1. Create a new Java folder under the main folder
Create a new folder under the 2.src folder test and create a new Java and Resources folder under the Test folder.

Next change the folder as the source folder, so that our project development is convenient to see the directory structure

Properties--->java Build path to the right of the source option click AddFolder on the right

When you are done, change the Java compiled class directory, we have the project core Java code, there is test code, in order to avoid conflict and overwrite,
It is recommended that you manually change the compiled directory by double-clicking each source folder output Dolder

After completion is a complete Web project in the Eclipse environment. The directory structure is as follows
1.src/mian/java the Java file that holds the project under this directory

2.src/mian/resources the resource file for the project under the directory (such as spring XML, etc.)

3.src/test/java Java files for project testing under this directory

4.src/test/resources resource files for project testing under this directory

Eclipse Create MAVEN Web project

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.