After eclipse integrates Maven3, create a detailed diagram of Java projects

Source: Internet
Author: User

1. Create a Java project

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

2) Select Maven-archetype-quickstart

            

3 Enter the project information

            

4 The generated Java project package structure is as follows

                   

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

<project xmlns= "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>cn.luxh.app</groupId> <artifactid>my-app </artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name
      >my-app</name> <url>http://maven.apache.org</url> <!--specify properties--> <properties> <junit.version>4.10</junit.version> <project.build.sourceencoding>utf-8</
      project.build.sourceencoding> <jdk.version>1.6</jdk.version> </properties> <build> <plugins> <!--Specify the compiled version of the JDK--> <plugin> <groupid>org.apache. Maven.plugins</groupid> <artifactid>maven-compiler-plugIn</artifactid> <version>2.5.1</version> <configuration>
                  <source>${jdk.version}</source> <target>${jdk.version}</target>
      <showWarnings>true</showWarnings> </configuration> </plugin> 
      </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope&gt ;test</scope> </dependency> </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 The production of the Web project package structure

              

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

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

Check Java, select 1.6 or higher JDK version

4.2 The tool only generates a source folder called Src/main/resource, 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 item, and enter folder name.

4.3 Modify the source folder's compile path, enter the Java Build Bath window, double-click the output folder under each file, and specify the path.

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

Select the selected allow output folders for source folders.

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

5) Configure TOMCAT7, publish run 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.