我自己用 docker 跑了个 nexus,项目在 mvn deploy 的时候,报 ReasonPhrase:Unauthorized,怎么解决? maven 的 settings 文件都配好用户名密码的,没有错的,项目 pom 文件也配好的
pom.xml 文件:
<profiles>
<profile>
<id>deploy-repository</id>
<activation>
<property>
<name>switch.deploy.repository</name>
</property>
</activation>
<distributionManagement>
<snapshotRepository>
<id>maven-snapshots</id>
<name>maven-snapshots</name>
<url>http://***/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>maven-releases</id>
<name>maven-releases</name>
<url>http://***/repository/maven-releases/</url>
</repository>
</distributionManagement>
</profile>
</profiles>
settings.xml 文件:
<servers>
<server>
<id>maven-snapshots</id>
<username>hx</username>
<password>hx</password>
</server>
<server>
<id>maven-releases</id>
<username>hx</username>
<password>hx</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<name>nexus</name>
<url>http://***/repository/maven-public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>deploy-repository</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>nexus</id>
<url>http://***/repository/maven-public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
1
oracleHe OP 但就是会报这个错:
[ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project com.vincent:basepom:0.0.1-SNAPSHOT (D:\work\my-projects\work-plan\workspaces\back\basepom\pom.xml) has 2 errors [ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom:2.1.9.RELEASE from/to nexus ( http://***/repository/maven-public/): Not authorized , ReasonPhrase:Unauthorized. @ line 29, column 25 -> [Help 2] [ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.cloud:spring-cloud-dependencies:pom:Greenwich.SR3 from/to nexus ( http://***/repository/maven-public/): Not authorized , ReasonPhrase:Unauthorized. @ line 37, column 25 -> [Help 2] |
2
Aruforce 2019-11-22 20:27:31 +08:00 via Android
在 settings xml servers 里面加上 nexus 这个 server 的账号和密码 然后…
Mvn deploy -p deploy-repository 你试下… |