Maven pom中的父标签代表什么? [英] What does the parent tag in Maven pom represent?

查看:603
本文介绍了Maven pom中的父标签代表什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:

<parent>
    <groupId>mycompany.trade.com</groupId>
    <artifactId>mycompany.trade.</artifactId>
    <version>1.1.1.0-SNAPSHOT</version>
</parent>

这是否意味着Maven将搜索父pom? 如果是,在哪里,按什么顺序?可能在上一级文件夹中?还是在本地存储库中或在回购中?

Does it mean that Maven will search for parent pom? If yes, where, in which order? May be in folder up 1 level? Or in local repository or in repo?

推荐答案

是的,maven从本地存储库(或 nexus之类的代理中读取父POM ),并通过合并来自父级和模块POM的信息来创建有效POM".

Yes, maven reads the parent POM from your local repository (or proxies like nexus) and creates an 'effective POM' by merging the information from parent and module POM.

另请参见 POM简介

使用父级的一个原因是您有一个中心位置来存储有关版本的信息 在所有模块中都应使用的工件,编译器设置等.

One reason to use a parent is that you have a central place to store information about versions of artifacts, compiler-settings etc. that should be used in all modules.

这篇关于Maven pom中的父标签代表什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆