Eclipse creates a Maven project

Source: Internet
Author: User

This week has been studying how to use Tomcat to create a MAVEN project, in the middle of some problems, so much trouble before the creation of the MAVEN project to run normally, so write this summary, for everyone to learn.

1 Determine if Eclipse has integrated maven

1.1 Open Eclipse's Preferences interface (way: Windows-Preferences), the left column has maven (red box in the picture), then it has been integrated maven.

2 Configuring Maven

2.0 if Maven is not found in the left sidebar, you will need to manually configure Maven for Eclipse.

2.1 Download Mevan plugin Http://pan.baidu.com/s/1bo23FIJ (extract code: VZ4X)

2.2 Copy the two folders (M2e,m2e-extras) in the Maven plugin folder to the Dropins folder in the Eclipse installation directory

2.3 Restart Eclipse and review preferences to see that MAVEN is properly integrated.

3. Create a Maven project

3.1 Click File--New--Other ... The interface appears. In "Wizards:" Enter "Maven", select "Maven Project", then click "Next>".

3.2 Tick "Create A simple project (skip archetype selection)" and click "next>".

3.3 Enter "Group ID:", "Artifact ID:", "Packaging:". Click "Finish". Created successfully.

(Note: When creating a Web project, packaging must choose the war; Create a Java project, packaging Select the jar)

4 Creating the error and resolution that Maven encountered (Pom.xml)

<Projectxmlns= "http://maven.apache.org/POM/4.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  <modelversion>4.0.0</modelversion>  <groupId>Com.bluestarwei</groupId>  <Artifactid>Hellomaven</Artifactid>  <version>0.0.1-snapshot</version>  <Packaging>War</Packaging>    <!--Introduce rack package to resolve JSP file error: The superclass "Javax.servlet.http.HttpServlet" was not found on the Java Build Path -  <Dependencies>      <Dependency>          <groupId>Javax.servlet</groupId>          <Artifactid>Servlet-api</Artifactid>          <version>3.0-alpha-1</version>          <Scope>Provided</Scope>      </Dependency>  </Dependencies>    <Build>      <Plugins>          <!--Introducing the TOMCAT7 plugin -          <plugin>              <groupId>Org.apache.tomcat.maven</groupId>              <Artifactid>Tomcat7-maven-plugin</Artifactid>              <version>2.2</version>              <Configuration>                  <Port>8181</Port>              </Configuration>          </plugin>                    <!--introduce the compiler plugin to solve the following error: 1.            Dynamic Web Module 3.0 requires Java 1.6 or newer.                2. Java compiler level does not match the version of the installed Java project facet.               3. One or more constraints has not been satisfied.  -          <plugin>              <groupId>Org.apache.maven.plugins</groupId>              <Artifactid>Maven-compiler-plugin</Artifactid>              <version>2.5.1</version>              <Configuration>                  <Source>1.7</Source>                  <Target>1.7</Target>              </Configuration>          </plugin>      </Plugins>  </Build>  </Project>

5 Running the MAVEN project

5.1 Right-click Project Name-maven-5 maven build ...

5.2 Enter "Tomcat7:run" in "Goals:" and then click "Run".

5.3 The program started successfully, enter the URL in the browser, view the page.

For more information, please visit: http://www.cnblogs.com/BlueStarWei/

Eclipse creates a Maven project

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.