1. Create parent Project
New--maven project--Tick Create a simple Project (skip archetype selected)--fill in the parent coordinates, pay attention to the packaging method select Pom
Configure the TOMCAT7 plugin in the Pom.xml file to enable the project to start with the MAVEN TOMCAT7 plug-in (no need to install Tomcat locally and get rid of tomcat boot)
1 <Build>2 <Plugins>3 <plugin>4 <groupId>Org.apache.tomcat.maven</groupId>5 <Artifactid>Tomcat7-maven-plugin</Artifactid>6 <version>2.2</version>7 <Configuration>8 <Path>/mybookstore</Path>9 <Port>8888</Port>Ten </Configuration> One </plugin> A </Plugins> - </Build>
2. Create sub-projects
Right-click the parent item Parent--maven module--Tick Create a simple project (skip archetype selected) and fill in the subproject name
Sub-module coordinates and packaging methods for layered development are:
Com.neuedu.maven--maven Bean--jar
Com.neuedu.maven--maven Utils--jar
Com.neuedu.maven--maven Dao--jar
Com.neuedu.maven--maven Service--jar
Com.neuedu.maven--maven Web--war
By right-clicking on the parent project, the corresponding <module>XXX</module> tag is automatically configured in the parent project's Pom.xml file by creating the child project.
Also automatically configures the parent project's coordinate information </parent> tags in the subproject <parent>
<Parent><groupId>Com.neuedu.maven</groupId><Artifactid>Maven-parent</Artifactid><version>0.0.1-snapshot</version></Parent>
3. Jar package dependencies between projects
When using MAVEN to develop tiered development, you need to configure layer B dependencies in the layer a pom.xml file when you want to use the properties or methods in tier B classes in layer a
4. Dependency of other JAR packages
When using MAVEN to manage a project, we do not need to put the jar package in the Lib directory, only need to configure the dependency in the Pom.xml file
depend on how to find:
① first in the local repository, if not found on the LAN to find, and can not find the connection to the central warehouse or mirror. When found in a central warehouse or mirror, if the LAN is
On the private network, the next time other users on the same LAN will be downloaded directly from the client, without having to connect to a central repository or mirror. If the LAN is not set up, it is saved in the local repository.
② use coordinates to retrieve items in a specific warehouse
Coordinate:
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.0.0.RELEASE</version>
Path in the warehouse:
Org/springframework/spring-core/4.0.0.release/spring-core-4.0.0.release.jar
5, the jar package download:
http://search.maven.org/
http://mvnrepository.com/"Recommended use of this"
When configuring the jar dependency in the Pom.xml file, the label display error indicates that the jar package download failed, need to manually download the response jar package to the warehouse, and placed in the specified directory, to facilitate the project to find the jar package
6, the installation of the project
With an inherited project, we only need to execute the install command with the parent project, and then install it and all of its sub-projects into the local repository.
Right-Parent--maven Build--tomcat7:run is successful and can be accessed via browser
How to create Web projects with inheritance in MAVEN (tiered development)