我已经尝试了将近一天的时间,使用Maven将来自Jersey的jar文件部署到我们当地的Artifactory。我对泽西岛的branch 2.6.x进行了一些小改动,并建造并包装了罐子。以下是泽西岛家长pom的摘录:
<groupId>org.glassfish.jersey</groupId>
<artifactId>project</artifactId>
<packaging>pom</packaging>
<version>2.6.rn-SNAPSHOT</version>
<name>jersey</name>
<description>
Jersey is the open source (under dual CDDL+GPL license) JAX-RS 2.0 (JSR 339)
production quality Reference Implementation for building RESTful Web services.
</description>
<distributionManagement>
<repository>
<id>central</id>
<name>central-repo</name>
<url>http://localhost/artifactory/libs-releases-local</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>central-repo-snapshots</name>
<url>http://localhost/artifactory/libs-snapshots-local</url>
</snapshotRepository>
</distributionManagement>
我的settings.xml
由神器生成并放在~/.m2/settings.xml
但是当我尝试使用mvn deploy
进行部署时,我得到以下内容:
Uploading: (https: //maven.java.net/content/repositories/snapshots/): Failed to transfer file: https://maven.java.net/content/repositories/snapshots/org/glassfish/jersey/project/2.6.rn-SNAPSHOT/project-2.6.rn-20150218.212627-1.pom. Return code is: 401, ReasonPhrase: Unauthorized.
我的完整settings.xml如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<username>admin</username>
<password>admin</password>
<id>central</id>
</server>
<server>
<username>admin</username>
<password>admin</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-releases</name>
<url>http://localhost/artifactory/libs-releases</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshots</name>
<url>http://localhost/artifactory/libs-snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-releases</name>
<url>http://localhost/artifactory/plugins-releases</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshots</name>
<url>http://localhost/artifactory/plugins-snapshots</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
答案 0 :(得分:0)
您必须在pom.xml中添加distributionManagement标记,其中url将是您的Artifactory的url并在settings.xml中添加凭据
您可以阅读有关此here的更多信息。