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

maven pom.xml文件结构 以及 repository 优先级概述

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

maven pom.xml文件结构 以及 repository 优先级概述

1. pom.xml 节点介绍

参考 https://maven.apache.org/pom.html#Inheritance

  
4.0.0  
  
...  
...  
...  
...  
...  
...  
...  
...  
...  
  
...  
...  
  
...  
...  
...  
...  
...  
...  
...  
...  
  
...  
...  
...   
...  
...  
...  
...  
...


    
      test
      ...
      ...
      ...
      ...
      ...
      ...
      ...
      ...
      ...
    
   
  
2. repository 优先级

Repository Order
Remote repository URLs are queried in the following order for artifacts until one returns a valid result:

  1. effective settings:
    A. Global settings.xml
    B.User settings.xml
  2. local effective build POM:
    A. Local pom.xml
    B. Parent POMs, recursively
    C. Super POM
  3. effective POMs from dependency path to the artifact.

For each of these locations, the repositories within the profiles are queried first in the order outlined at Introduction to build profiles.
Before downloading from a repository, mirrors configuration is applied.
Effective settings and local build POM, with profile taken into account, can easily be reviewed to see their repositories order with mvn help:effective-settings and mvn help:effective-pom -Dverbose.
以上部分 引用自官方说明 https://maven.apache.org/guides/introduction/introduction-to-profiles.html

制品(artifacts)的url按照以下顺序查找配置文件,直到找到一个有效的仓库
仓库有效顺序

  1. seting.xml
    1. 全局 setting.xml (${maven.home}/conf/settings.xml).
    2. 用户 setting.xml (%USER_HOME%/.m2/settings.xml).
  2. 影响构建的本地pom
    1. 当前项目的pom.xml
    2. 父的pom.xml,递归查找
    3. root pom.xml
  3. 从依赖路径到制品的有效pom

对于上面的位置,先查找可用的profile
在下载制品仓库之前,会先应用镜像配置与仓库
可用通过 mvn help:effective-settings 和 mvn help:effective-pom -Dverbose 查看有效配置和完整pom

# 生成完整的pom文件
# Effective POMs, after inheritance, interpolation, and profiles are applied:
# 将影响当前pom的配置,通过继承,插值,配置文件(profile) 应用到当前pom文件
mvn help:effective-pom -Dverbose
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/992191.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

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

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