Maven的pom.xml文件结构之基本配置parent和继承结构
2017-07-18 16:42
417 查看
1.Maven项目的继承
Maven项目之间不仅存在多模块的聚合关系,而且Maven项目之间还可以存在相互继承的关系。
Maven项目之间的继承关系通过<parent>表示,在子Maven项目的POM中配置示例如下:
[html] view
plain copy
<parent>
<groupId>com.ericsson.jcat</groupId>
<artifactId>jcat-bundle</artifactId>
<version>2.0</version>
<relativePath>../jcat-bundle</relativePath>
</parent>
说明:给出被继承的父项目的具体信息。
其中的relativePath给出父项目相对于子项目的路径,这样在构件子项目时首先从该相对路径查找父项目,如果没有才会从本地库或进而远程库中查找父项目。
2.在子项目中,能够继承父项目的如下配置:
dependencies
developers
contributors
plugin lists
reports lists
plugin executions with matching ids
plugin configuration
3.Maven的Super POM
类似于Java中的java.lang.Object类,所有Java类都继承自该类。在Maven中也存在一个特殊的POM,被称为Super
POM。任何Maven项目的POM都继承自Super POM。
在Super POM中,设置如下:
Maven的central库
Maven的central插件库
build的基本参数和4个插件(maven-antrun-plugin、maven-assembly-plugin、maven-dependency-plugin和maven-release-plugin)
reporting的基本目录
一个profile(id=release-profile)
Maven项目之间不仅存在多模块的聚合关系,而且Maven项目之间还可以存在相互继承的关系。
Maven项目之间的继承关系通过<parent>表示,在子Maven项目的POM中配置示例如下:
[html] view
plain copy
<parent>
<groupId>com.ericsson.jcat</groupId>
<artifactId>jcat-bundle</artifactId>
<version>2.0</version>
<relativePath>../jcat-bundle</relativePath>
</parent>
说明:给出被继承的父项目的具体信息。
其中的relativePath给出父项目相对于子项目的路径,这样在构件子项目时首先从该相对路径查找父项目,如果没有才会从本地库或进而远程库中查找父项目。
2.在子项目中,能够继承父项目的如下配置:
dependencies
developers
contributors
plugin lists
reports lists
plugin executions with matching ids
plugin configuration
3.Maven的Super POM
类似于Java中的java.lang.Object类,所有Java类都继承自该类。在Maven中也存在一个特殊的POM,被称为Super
POM。任何Maven项目的POM都继承自Super POM。
在Super POM中,设置如下:
Maven的central库
Maven的central插件库
build的基本参数和4个插件(maven-antrun-plugin、maven-assembly-plugin、maven-dependency-plugin和maven-release-plugin)
reporting的基本目录
一个profile(id=release-profile)
相关文章推荐
- Maven 的pom.xml文件结构之基本配置parent和继承结构
- Maven的pom.xml文件结构之基本配置parent和继承结构
- Maven的pom.xml文件结构之基本配置parent和继承结构
- Maven的pom.xml文件结构之基本配置parent和继承结构
- Maven的pom.xml文件结构之基本配置packaging和多模块聚合结构
- Maven的pom.xml文件结构之基本配置dependencies和dependencyManagement
- Maven的pom.xml文件结构之基本配置properties
- Maven的pom.xml文件结构之基本配置packaging和多模块聚合结构
- Maven的pom.xml文件结构之Build配置build
- (转)Maven的pom.xml文件结构之Build配置build
- Maven的pom.xml文件结构之Build配置build
- Maven的pom.xml文件结构之环境配置distributionManagement
- Maven的pom.xml文件结构之Build配置build
- Maven的pom.xml文件结构之环境配置distributionManagement
- Maven的pom.xml文件结构之Build配置reporting
- Maven的pom.xml文件结构之环境配置profiles
- Maven搭建hadoop环境之pom.xml基本配置
- maven配置pom.xml文件详解
- maven的配置,maven构建工程,pom.xml文件配置,maven打包