Eclipse creates a Maven project

Source: Internet
Author: User

1. Create a Java project

1) File--->new--->other--->maven--->maven Projet

2) Select Maven-archetype-quickstart

3) Enter information for the project

      

4) The resulting Java project package structure is as follows

    

5) Modify Pom.xml to specify the JDK version at compile time

1 <Projectxmlns= "http://maven.apache.org/POM/4.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"2 xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">3   <modelversion>4.0.0</modelversion>4 5   <groupId>Cn.luxh.app</groupId>6   <Artifactid>My-app</Artifactid>7   <version>0.0.1-snapshot</version>8   <Packaging>Jar</Packaging>9 Ten   <name>My-app</name> One   <URL>http://maven.apache.org</URL> A  -   <!--Specifying Properties - -   <Properties> the       <junit.version>4.10</junit.version> -     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> -       <jdk.version>1.6</jdk.version> -   </Properties> +  -   <Build> +       <Plugins> A           <!--specifying the compiled version of the JDK - at           <plugin> -               <groupId>Org.apache.maven.plugins</groupId> -               <Artifactid>Maven-compiler-plugin</Artifactid> -               <version>2.5.1</version> -               <Configuration> -                   <Source>${jdk.version}</Source> in                   <Target>${jdk.version}</Target> -                   <showwarnings>True</showwarnings> to               </Configuration> +           </plugin> -       </Plugins> the   </Build> *   <Dependencies> $     <Dependency>Panax Notoginseng       <groupId>Junit</groupId> -       <Artifactid>Junit</Artifactid> the       <version>${junit.version}</version> +       <Scope>Test</Scope> A     </Dependency> the   </Dependencies> + </Project>

  2. Create a Web project

1) File--->new--->other--->maven--->maven Projet

2) Select Maven-archetype-webapp

     

3) Fill in the project information

     

4) Production of Web project package structure

         

4.1) Convert the project to a Dynamic Web Module, right-click on the project, select Properties, then select Project Facets, then click Convert to Faceted form ...

Tick dynamic Web Module, select 3.0 to support servlet3.0

Tick Java, select JDK version 1.6 or higher

4.2) The tool only generates a source folder called Src/main/resource, and we need to manually add Src/main/java, Src/test/java, and Src/test/resource three source folder, right-click New---->source folder on the project and enter the folder name.

4.3) Modify the compilation path of the source folder, go to the Java Build Bath window, double-click the output folder under each of the folders to specify the path.

Src/main/java and Src/main/resource Specify Target/calsses,src/test/java and Src/test/resource specify target/test-classes

Select the Allow output folders for source folders.

4.4) Configure the deployment of the program deployment Assembly, delete the test of the two items, test of the program is not required when the release, add Maven dependency library, release can be published to the Lib directory, add/src/main/ WebApp the root directory for the deployment

5) Configure TOMCAT7, publish run project

Reprint: Http://blog.csdn.net/edward0830ly/article/details/8748951#comments

If there is a copyright issue, please contact me in time to delete the reference! Thank the original author "edward0830ly"!

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.