人工mvn部署未自动完成 [英] Artifactory mvn deploy not auhorized
问题描述
我已经在kubernetes集群上安装了artifactory-oss,但是我无法使用maven对其进行部署.
I have installed artifactory-oss on a kubernetes cluster but I can't manage to deploy on it using 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
And here is my 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
,导致出现上面指定的错误.
At first the URL generated by artifactory was https://artifactory.adibox.be:80/artifactory/libs-snapshot
but I was getting an SSL error. I removed the :80
and I result in the error specified above.
有什么主意吗? 是因为Artifactory部署在Kubernetes集群上吗?
Any idea what could be wrong ? Is it because Artifactory is deployed on a Kubernetes cluster ?
我可以通过以下方式在浏览器中查看工件列表: https://artifactory.adibox.be/artifactory/libs-snapshot-local,然后输入我的凭据.
I'm able to see the list of artifacts in the browser by going to https://artifactory.adibox.be/artifactory/libs-snapshot-local and entering my credentials.
谢谢.
推荐答案
我在gcp上部署Nexus时遇到了类似的错误.
I had a similar error with Nexus deployed on gcp.
将我的设置与您的设置进行比较,我认为您需要镜像ID.就我而言:关系版本
Comparing my settings with your settings, I think you need the mirror id. In my case : nexus-releases
如您在我的附加设置中所见,<server>
定义了ID为<id>nexus-releases</id>
的用户/密码.
As you can see in my attached settings, <server>
defines an user/password with an id <id>nexus-releases</id>
.
然后在镜像"部分中,具有和ID与服务器ID相同的值: nexus-releases
Then in mirror section, its has and id with the same value of server 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 也是必需的:
Finally at deploy, this id nexus-releases is required too:
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
无论如何,如果错误仍然存在,我建议您重现问题的步骤.如果无法重现该问题,则找不到解决方案.
Anyway if error continues, I advice you the steps to reproduce your issue. If you cannot reproduce the issue, you can not find a solution.
- 尝试使用本地主机工件.可能是kuberentes,gcp,aws等错误
- 使用一个空的m2存储库,并确保已使用seetinng.xml.您可以将这句话添加到mvn deploy命令中:
-s /tmp/my_settings.xml -Dmaven.repo.local=/tmp/m2
- 尝试使用linux代替Windows.
这篇关于人工mvn部署未自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!