栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Maven pom中的parent.relativePath的作用(官网说明)

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Maven pom中的parent.relativePath的作用(官网说明)

在开发项目过程中遇到一个问题,引入parent没有加relativePath会报红,

解决的办法是加

项目结构说明:项目未放置在parent项目目录下。parent项目和子项目在目录上是平级的:

在网上看到很多人问这个问题,回答都是一致的copy.

现在从官网上找答案 :

The relative path of the parent pom.xml file within the check out. If not specified, it defaults to ../pom.xml. Maven looks for the parent POM first in this location on the filesystem, then the local repository, and lastly in the remote repo. relativePath allows you to select a different location, for example when your structure is flat, or deeper without an intermediate parent POM. However, the group ID, artifact ID and version are still required, and must match the file in the location given or it will revert to the repository for the POM. This feature is only for enhancing the development in a local checkout of that project. Set the value to an empty string in case you want to disable the feature and always resolve the parent POM from the repositories.
Default value is: ../pom.xml.

1.不加:默认是 ../pom.xml

2.也可以在此指定

指定后将在文件系统从指定位置查找,然后是本地仓库,最后是远程仓库

(优先级 指定位置 > 本地仓库 > 远程仓库)

3.加上标签关闭这个特性(feature) ,将永远从repositories解析读取parent  POM

到此完成.(英文水平有限,如有问题请指正,谢谢!)

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/600888.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号