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> <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 > <URL>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> </DEP endencies> <build> <finalName>demo-service</finalName> </build></project>
View Code
4, the total engineering structure is as follows
Eclipse creates MAVEN module engineering