在Ubuntu 12.04.4 LTS上运行的SonarQube 5.1
詹金斯诉。 1.616在Ubuntu 12.04.4 LTS上运行
SonarQube插件2.2.1
在Ubuntu 12.04.5 LTS上运行的Artifactory Pro Power Pack 3.8.0(rev.30190)
sbt 0.13.8
Apache Maven 3.0.4
Maven主页:/ usr / share / maven
Java版本:1.8.0_45,供应商:Oracle Corporation
Java home:/usr/lib/jvm/jdk1.8.0_45/jre
默认语言环境:en_US,平台编码:UTF-8
操作系统名称:" linux",版本:" 3.5.0-23-generic",arch:" amd64",family:" unix"
试图在Jenkins Build中使用SonarQube Jenkins插件,该插件似乎尝试重建整个构建并重新解析Artifactory中的所有依赖项。问题是,与构建的其余部分不同,当SonarQube插件从Artifactory请求工件时,它会以非认证用户身份执行,Artifactory会拒绝该请求。
我已尝试复制< servers />,< profiles />和< activeProfiles />从jenkins用户的settings.xml文件到/etc/maven.settings.xml并明确告诉插件使用前者作为用户设置,后者作为系统设置 - 简而言之,我能找到的任何内容和所有内容都记录在案对于中世纪暴力强制该插件使用jenkins用户的凭据,但它仍然只是作为未经过身份验证的用户连接并拒绝其请求。
来自Jenkins Log的示例(敏感信息被混淆):
INFO: No credentials available for BASIC 'Artifactory Realm'@libs.<organization>;:443
[WARNING] Could not transfer metadata <GAV>/maven-metadata.xml from/to ArtifactorySnapshotsRepo (<Artifactory URL>/artifactory/libs-snapshot/): Not authorized.
[WARNING] The POM for org.codehaus.jackson:jackson-core-asl:jar:1.8 is missing, no dependency information available
[WARNING] The POM for org.codehaus.jackson:jackson-mapper-asl:jar:1.8 is missing, no dependency information available
[WARNING] Failure to transfer <GAV>/maven-metadata.xml from <Artifactory URL>/artifactory/libs-snapshot/ was cached in the local repository, resolution will not be reattempted until the update interval of ArtifactorySnapshotsRepo has elapsed or updates are forced. Original error: Could not transfer metadata <GAV>/maven-metadata.xml from/to ArtifactorySnapshotsRepo (<Artifactory URL>/artifactory/libs-snapshot/): Not authorized.
在Artifactory的request.log中,我们得到了(再次对敏感信息进行了模糊处理):
20150916190344|5181|REQUEST|<Jenkins IP>;|non_authenticated_user|GET|/libs-snapshot//<GAV>/maven-metadata.xml|HTTP/1.0|401|0
SonarQube插件启动的maven命令如下(为清晰起见,行被破坏,敏感信息被混淆):
mvn
-f /var/lib/jenkins/workspace/NE-BUILD-1/pom.xml
-s /var/lib/jenkins/.m2/settings.xml
-gs /etc/maven/settings.xml
-e
-B org.codehaus.mojo:sonar-maven-plugin:2.6:sonar
-Dsonar.jdbc.url=jdbc:postgresql://<server>:<port>/sonar
******** ********
-Dsonar.host.url=http://<server>:<port>/
-Dsonar.branch=sbt-publish-deb ******** ********
如何让此过程正确地对Artifactory进行身份验证?