我已经在kubernetes集群上安装了artifactory-oss,但是我无法使用maven对其进行部署。
运行mvn deploy
时出现此错误
.0-SNAPSHOT/maven-metadata.xml from/to snapshots (https://artifactory.adibox.be/artifactory/libs-snapshot-local): Not authorized -> [Help 1]
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>be.adibox</groupId>
<artifactId>adiboxorm</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<modules>
<module>annotations</module>
</modules>
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<name>artifactory-oss-artifactory-0-snapshots</name>
<url>https://artifactory.adibox.be/artifactory/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
</dependencies>
</project>
这是我的settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<username>${security.getCurrentUsername()}</username>
<password>${security.getEscapedEncryptedPassword()!"<myencryptedpassword>"}</password>
<id>central</id>
</server>
<server>
<username>${security.getCurrentUsername()}</username>
<password>${security.getEscapedEncryptedPassword()!"<myencryptedpassword>"}</password>
<id>snapshots</id>
</server>
</servers>
<mirrors>
<mirror>
<mirrorOf>*</mirrorOf>
<name>libs-snapshot</name>
<url>https://artifactory.adibox.be/artifactory/libs-snapshot</url>
<id>libs-snapshot</id>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://artifactory.adibox.be/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://artifactory.adibox.be/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://artifactory.adibox.be/artifactory/libs-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://artifactory.adibox.be/artifactory/libs-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
起初,人工制品生成的URL是https://artifactory.adibox.be:80/artifactory/libs-snapshot
,但是我遇到了SSL错误。我删除了:80
,导致出现上面指定的错误。
有什么主意吗? 是因为Artifactory部署在Kubernetes集群上吗?
我可以通过以下方式在浏览器中查看工件列表: https://artifactory.adibox.be/artifactory/libs-snapshot-local并输入我的凭据。
谢谢。
答案 0 :(得分:1)
我在gcp上部署Nexus时遇到了类似的错误。
将我的设置与您的设置进行比较,我认为您需要镜像ID。就我而言:关系版本
您可以在我的附加设置中看到,<server>
定义了ID为<id>nexus-releases</id>
的用户/密码。
然后在镜像部分中,具有和ID与服务器ID相同的值: nexus-releases
<settings>
<pluginGroups></pluginGroups>
<proxies></proxies>
<servers>
<server>
<id>nexus-releases</id>
<username>jane</username>
<password>doe</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus-releases</id>
<mirrorOf>*</mirrorOf>
<name>central</name>
<url>https://mynexus.com/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles></profiles>
</settings>
最后在部署时,也需要该ID nexus-releases :
mvn deploy:deploy-file -DgeneratePom=false -DrepositoryId=nexus-releases -Durl=https://mynexus.com/repository/maven-releases/ -DpomFile=pom.xml -Dfile=myjar-1.0.0.jar
无论如何,如果错误仍然存在,我建议您重现问题的步骤。如果无法重现该问题,则找不到解决方案。
-s /tmp/my_settings.xml -Dmaven.repo.local=/tmp/m2