Project Object Model

简单理解一个应用由多个project构成,其中一个project为parent(packaging类型为pom),而其他的project为model(packaging类型为jar)同时继承parent从而构成一个树状结构。

.
 |-- web-module
 |   `-- pom.xml
 `-- pom.xml

<!--parent pom中的配置-->
<modelVersion>4.0.0</modelVersion>
<groupId>com.flybird.tutorial</groupId>
<artifactId>tutorial-parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>

<modules>
     <module>app/web</module>
</modules>


<!--继承parent pom中的配置-->
<parent>
    <groupId>com.flybird.tutorial</groupId>
    <artifactId>tutorial-parent</artifactId>
    <version>1.0</version>
    <relativePath>../../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>com.flybird.tutorial</groupId>
<artifactId>tutorial-web</artifactId>
<version>1.0</version>
<packaging>war</packaging>

将parent pom安装到本地repo

在parent pom目录执行命令mvn -N install