【发布时间】:2020-01-14 22:05:15
【问题描述】:
我已经在 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>
起初,artifactory 生成的 URL 是 https://artifactory.adibox.be:80/artifactory/libs-snapshot,但我遇到了 SSL 错误。我删除了:80,导致上面指定的错误。
知道有什么问题吗? 是不是因为 Artifactory 部署在 Kubernetes 集群上?
我可以通过访问在浏览器中查看工件列表 https://artifactory.adibox.be/artifactory/libs-snapshot-local 并输入我的凭据。
谢谢。
【问题讨论】:
-
您是否尝试在 settingx.xml 中明确输入用户名/密码只是为了确保您的帐户有效
-
是的,我尝试以明文形式使用用户名、电子邮件、明文密码、加密密码的所有组合。我只是没有尝试“转义密码”,因为我不确定
getEscapedEncryptedPassword实际上在做什么。 -
我猜这意味着你可以连接,对吧?也许您需要查看权限:您的帐户必须被授权才能部署新工件(某种写入或部署权限)
-
“我猜这意味着你可以连接,对吧?”。我会说不。也许我没有正确解释它,但如果我设置明确的用户名和密码,我会得到完全相同的错误“未授权”。另外,我尝试连接的用户被标记为“管理员”。
标签: maven artifactory