Maven配置私有镜像库(配置用户密码等)、阿里云镜像仓库、以及项目配置使用 deploy 命令推送到指定仓库等 您所在的位置:网站首页 阿里云root密码怎么查看 Maven配置私有镜像库(配置用户密码等)、阿里云镜像仓库、以及项目配置使用 deploy 命令推送到指定仓库等

Maven配置私有镜像库(配置用户密码等)、阿里云镜像仓库、以及项目配置使用 deploy 命令推送到指定仓库等

2024-04-10 22:02| 来源: 网络整理| 查看: 265

一、配置私有镜像库:

1、打开maven配置文件:xxx\xxx\apache-maven-3.6.3\conf\settings.xml

2、配置私有库(以及用户名密码)、阿里云库地址,如下:

alimaven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ central nexus-snapshots admin xxx nexus-releases admin xxx jk_nexus true nexus-snapshots snapshots http://xxx:8081/repository/maven-snapshots/ true true nexus-releases releases http://xxx:8081/repository/maven-releases/ true true ali-maven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ true true ali-plugin aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ jk_nexus

注意: 【1】mirrors: 节点下配置公用阿里云中央仓库地址

【2】servers: 节点中配置的是私有库的账户和密码,id需要和 profiles 节点中配置的id一致,分为 snapshots 、releases 需要单独配置账户和密码

【3】profiles:每个profile节点为一个配置信息,activation节点配置默认激活该配置信息,repositories 节点配置仓库的id、name、url等信息,插件仓库地址配置节点为 pluginRepositories

【4】activeProfiles:节点中配置需要激活启动的配置信息,支持激活启动多个配置信息

二、配置阿里云镜像库

1、打开maven配置文件:xxx\xxx\apache-maven-3.6.3\conf\settings.xml

2、在mirrors节点下配置如下代码:

aliyunmaven 阿里云公共仓库 https://maven.aliyun.com/repository/public * nexus-aliyun Nexus aliyun https://maven.aliyun.com/nexus/content/groups/public central

注意 【1】是 https 协议的 【2】也可以只配置 http 协议的,http://maven.aliyun.com/nexus/content/groups/public/

3、如果提示验证证书错误,可以设置参数忽略证书验证å¨è¿éæå¥å¾çæè¿°

忽略证书验证参数代码如下:

-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

三、父子结构项目,配置指定仓库地址,用于把当前项目jar包 deploy 到此仓库中

1、在父项目的 pom 文件中,配置仓库地址信息,如下

nexus-releases corp nexus-releases http://xxx:8081/repository/xxx-releases/ nexus-snapshots corp nexus-snapshots http://xxx:8081/repository/xxx-snapshots/

2、完成配置,使用 maven deploy 即可把当前项目jar包推送到指定的仓库中

注意: 【1】此父项目 pom 中配置的仓库地址,只用作 deploy 推送,拉取镜像包仍然会从 maven 的 setting.xml 文件配置的仓库地址拉取

【2】如果其他项目需要依赖【1】推送的jar包,需要在 maven setting.xml 文件中也配置推送时指定的仓库地址才可以拉取到最新的依赖,如下:

lifehall-snapshots snapshots http://xxx:8081/repository/xxx-snapshots/ true true lifehall-releases releases http://xxx:8081/repository/xxx-releases/ true true

【3】此父项目 pom 中配置的仓库地址,推送时需要用户拥有对应仓库的权限(配置用户密码在 maven setting.xml 的 servers 节点下配置,见步骤一),否则无法完成 deploy



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有