Eclipse creates MAVEN module engineering

Source: Internet
Author: User
Tags webhost

Creating a MAVEN module project can be done using the Eclipse tool.

1, create the parent project , note, to choose maven-archetype-site-simple

New--"Maven project

Fill in the project name, package name information

At this time, the parent project Pom file content, packaging have jar, war, Pom and so on, and the parent project is POM

<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>com.yuanmeng</groupId>  <artifactId>demo</artifactId>  <version>0.0.1-SNAPSHOT</version>  <packaging >pom</packaging>  <distributionManagement>    <site>      <id>website </id>      <URL>SCP://webhost.company.com/www/website</url>    </ site>  </distributionManagement>  <properties>    <project.build.sourceencoding >UTF-8</project.build.sourceEncoding>  </properties></project>

2. Create a Java submodule project

Select the parent project demo that you created above, and then right-click New--MAVEN module

Note: This is created to create a Java project , so the maven-archetype-quickstart is selected

Fill in the project name, package name information

After the sub-project Demo-client is created, the Java sub-module Pom

<?xml version= "1.0"? ><project xsi:schemalocation= "http://maven.apache.org/POM/4.0.0/http Maven.apache.org/xsd/maven-4.0.0.xsd "xmlns=" http://maven.apache.org/POM/4.0.0 "Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" > <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.yuanmeng</groupId> <artifactId>demo</artifactId> <version>0.0.1- snapshot</version> </parent> <artifactId>demo-client</artifactId> <packaging>jar </packaging> <name>demo-client</name> <url>http://maven.apache.org</url><properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </ properties> <dependencies> <dependency> <groupId>junit</groupId> &LT;ARTIFACTID&G t;junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependen Cy> </dependencies></project>
View Code

The parent Project demo Pom file is configured as follows

<?xml version= "1.0" encoding= "UTF-8"? ><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> Com.yuanmeng</groupid> <artifactId>demo</artifactId> <version>0.0.1-snapshot</version > <packaging>pom</packaging> <distributionManagement> <site> <id>website</id > &LT;URL&GT;SCP://webhost.company.com/www/website</url></site> </distributionManagement> <properties> <project.build.sourceencoding>utf-8</ Project.build.sourceencoding> </properties><modules> <module>demo-client</module> </modules></project>

3. Create a Web sub-module project

The steps are identical to 2, the only difference being that creating a Web project is to choose Maven-archetype-webapp

Web sub-module Pom.xml

<?xml version= "1.0"? ><project xsi:schemalocation= "http://maven.apache.org/POM/4.0.0/http Maven.apache.org/xsd/maven-4.0.0.xsd "xmlns=" http://maven.apache.org/POM/4.0.0 "Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" > <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.yuanmeng</groupId> <artifactId>demo</artifactId> <version>0.0.1- snapshot</version> </parent> <artifactId>demo-service</artifactId> <packaging>war </packaging> <name>demo-service Maven webapp</name> <url>http://maven.apache.org</url><dependencies> <dependency> <groupId>junit</groupId> <artifactid>junit</arti factid> <version>3.8.1</version> <scope>test</scope> </dependency> &LT;/DEP endencies> <build> <finalName>demo-service</finalName> </build></project>
View Code

4, the total engineering structure is as follows

Eclipse creates MAVEN module engineering

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.