我有一個Artifactory(版本4.15.0)實例,它爲多個工件提供Maven2存儲庫。 Gradle(版本3.3)解決並下載大多數依賴關係就好了。但是,有些解決方案在Gradle Artifactory插件解析器查找錯誤的URL時出現奇怪的錯誤。有趣的是,正確的URL用於定位POM,然後當它嘗試下載JAR時使用了錯誤的URL。Artifactory Gradle分辨率URL不正確且不一致
POM URL
[DEBUG] [org.apache.http.impl.execchain.MainClientExec] Executing request HEAD http://artifactoryLocation:8081/artifactory/libs-release/org/swinglabs/swingx/swingx-all/1.6.5-1/swingx-all-1.6.5-1.pom HTTP/1.1
JAR URL
[DEBUG] [org.gradle.internal.resource.transport.http.HttpClientHelper] Performing HTTP HEAD: http://artifactoryLocation:8081/artifactory/libs-release/org.swinglabs.swingx/swingx-all/1.6.5-1/swingx-all-1.6.5-1.jar
正如你可以看到某種原因使用的JAR URL中包含.
,而不是/
。我不確定爲什麼會發生這種情況。 POM正確下載,而JAR依賴性無法解析和下載。任何修復建議?
另一個有趣的發現是使用artifactory-ivy-resolver
代替artifactory-maven-resolver
。如上所述,存儲庫是Artifactory中的Maven2存儲庫,並在Gradle build.gradle文件中聲明 - 關於常春藤並沒有提及任何內容,但是正在使用常青藤解析器。我不確定這是否是問題的一部分。
的build.gradle
apply plugin: 'java'
apply plugin: 'com.jfrog.artifactory'
repositories {
}
buildscript {
repositories {
maven {
url 'http://artifactoryLocation:8081/artifactory/libs-release'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
jcenter()
}
dependencies {
//Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
}
}
dependencies {
compile 'javax.media:jmf:2.1.1e'
compile 'com.bbn.openmap:openmap:5.0'
compile 'org.igniterealtime.smack:smack:3.2.2'
compile 'org.igniterealtime.smack:smackx:3.2.2'
compile 'org.swinglabs.swingx:swingx-all:1.6.5-1'
compile 'gov.nasa.worldwind:worldwind:2.1.0'
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
resolve {
repository {
repoKey = 'libs-release'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
你可以發佈你的build.gradle嗎? –
請同時發佈gradle版本。 – Henry
@MartinLinha我發佈了build.gradle – woody