首页 > 其他分享 >Maven 环境踩坑及完整配置

Maven 环境踩坑及完整配置

时间:2023-01-06 13:34:50浏览次数:32  
标签:maven http com 配置 Maven 完整 aliyun true public


文章目录

  • ​​一、错误描述​​
  • ​​二、解决​​
  • ​​三 、完整配置​​

一、错误描述

maven Could not transfer artifact XXX fromto XXX(XXX) Not authorized , ReasonPhrase Unauthorized.

在公司使用maven私服时出现上述错误,检查配置已经配置了snapshots、releases的认证。

二、解决

由于公司私服public也需要认证,故添加public的相关认证即可。

三 、完整配置

<?xml version="1.0" encoding="UTF-8"?>


<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- 本地仓库的路径。默认值为${user.home}/.m2/repository。 -->
<localRepository>E:\work\file\xxx</localRepository>

<!-- 当没有显示提供机构信息时的默认值 -->
<pluginGroups>
<pluginGroup>com.dingwen</pluginGroup>
</pluginGroups>

<!-- 配置代理 -->
<proxies></proxies>

<servers>

<!-- 公司私服配置开始 -->

<server>
<!-- 此处ID必须与pom文件中私服的配置部署ID一致 -->
<id>maven-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>maven-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<!-- 当访问需要认证时配置 -->
<server>
<!-- 此处ID与mirrors的ID一致 -->
<id>company-maven-public</id>
<username>admin</username>
<password>admin123</password>
</server>

<!-- 公司私服配置结束 -->

<!-- 华为云 -->
<server>
<id>huaweicloud</id>
<username>anonymous</username>
<password>devcloud</password>
</server>

</servers>


<!-- 相当于拦截器访问改地址是映射的配置 -->
<mirrors>


<!-- 公司-->
<mirror>
<!-- 上面server认证ID -->
<id>company-maven-public</id>
<!-- * 表示匹配所有-->
<!-- external:*: 使用所有远程仓库,本地localhost除外-->
<!-- 仓库1,...,仓库2--->
<!-- *,!仓库1 除了仓库1所有-->
<!-- 仓库ID -->
<mirrorOf>companymaven</mirrorOf>
<url>http://xxx/repository/maven-public/</url>
</mirror>

<!-- 阿里云 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<!-- 仓库ID -->
<mirrorOf>alimaven</mirrorOf>
</mirror>

<!-- 华为云 -->
<mirror>
<id>huaweicloud</id>
<!-- 仓库ID -->
<mirrorOf>huaweimaven</mirrorOf>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</mirror>

</mirrors>



<profiles>
<!-- 公司 nexus 私服配置-->
<profile>
<id>company</id>
<repositories>
<repository>
<id>companymaven</id>
<name>company maven</name>
<url>http:/xxx/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>companymaven</id>
<url>http://xx/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

</profile>
<!-- JDK 版本配置 -->
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>

<!-- 阿里云配置 -->
<profile>
<id>ali</id>
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>

<!-- 华为云配置 -->
<profile>
<id>huawei</id>
<repositories>
<repository>
<id>huaweimaven</id>
<name>huawei maven</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>huaweimaven</id>
<name>huawei maven</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>

<!-- 激活配置 -->
<activeProfiles>
<activeProfile>company</activeProfile>
<activeProfile>jdk-1.8</activeProfile>
<activeProfile>ali</activeProfile>
<activeProfile>huawei</activeProfile>
</activeProfiles>

</settings>


标签:maven,http,com,配置,Maven,完整,aliyun,true,public
From: https://blog.51cto.com/u_15932195/5993029

相关文章

  • vue 配置代理
    如果接口请求存在跨域问题且后端暂没时间解决,可以通过vue-cli配置代理的方式解决:.env.development中设置VUE_APP_BASE_API=LocalLocal为该项目运行时的服务器地址,vue......
  • maven将本地文件deploy到私库
    mvninstall:install-filedeploy:deploy-file\-DgroupId=org.libvirt\-DartifactId=libvirt\-Dversion=0.5.3\-Dpackaging=jar\-Dfile=libvirt-0.5.3.jar\-Dj......
  • H3C-配置Telnet登录设备
    进入系统视图,并开启Telnet服务,默认开启。<H3C>system-view[H3C]telnetserverenable配置VTY接口认证模式为scheme模式(用户名+密码认证)。[H3C]linevty04[H3C-ui-vty0......
  • [ensp自学]1.基本配置
    创建vlan vlanbatch1020把端口g0/0/1加入vlan10intg0/0/1portlink-typeaccessportdefaultvlan10给vlan10创建网关,才可以和其他vlan通信intvlan10ipadd192.168......
  • H3C-配置Console口密码登录方式
    (1)密码登录方式配置步骤进入系统视图<H3C>system配置AUX接口认证模式为password模式(密码认证)[H3C]lineaux0[H3C-line-aux0]authentication-modepassword//另两种认......
  • 『中级篇』docker之CI/CD持续集成—真实JAVA-Maven项目的CI演示(73)
    ICD。项目通过gitlab和gitlabCI进行CICD。源码地址:​​​https://github.com/limingios/gitlabci-maven​​​源码:​​https://github.com/limingios/docker/tree/master/......
  • 『中级篇』docker之运行nginx跳转到本地的jar并配置https(番外篇)(80)
    2g内存,安装了mysql容器,java容器,nginx容器。具体安装docker我就不说了,没啥讲的重复很多遍的。mysql也之前讲过。nginx的安装新建立nginx的目录nginx防止出现下面的错误docke......
  • 使用ONVIF协议把设备接入视频网关的配置流程
    1.添加ONVIF用户名和密码以大华设备添加ONVIF用户名和密码为示例①打开浏览器输入摄像头的IP地址,登录摄像头web页面②点击“设置”->“系统管理”->”用户管理”-......
  • openconf配置第三方SMTP服务器
    1.下载好的openconf放到网站目录里,在网页里打开,按照步骤安装2.安装完毕之后登录帐号,然后打开首页的Modules  3.刚安装好的模块里,邮件还是未设置的状态,首先去提示的g......
  • MSTP配置
    全网所有交换机都要配置如下命令,包括接入,汇聚交换机:stpregion-configuration   region-nameHuawei    revision-level12    instance10vlan10......