我正在尝试使用人工Gradle插件解决配置阶段的依赖性。
apply plugin: 'java'
apply plugin: 'com.jfrog.artifactory'
artifactory {
contextUrl = "${artifactory_contextUrl}"
...
resolve {
repository {
repoKey = 'repo'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
dependencies {
compile 'commons-lang:commons-lang:+'
}
task testCustomResolve {
logger.quiet configurations.getByName('compile').singleFile.absolutePath
}
它给了我
它在执行阶段具有魅力
task testCustomResolve << {
logger.quiet configurations.getByName('compile').singleFile.absolutePath
}
或当我使用mavenCentral()
repositories {
mavenCentral()
}
最佳答案
如果您不需要发布到Artifactory,我注意到如果您不使用artifactory {}
语法,它会更好。相反,请尝试使用:
plugins {
id "com.jfrog.artifactory" version "4.4.10"
}
repositories {
mavenLocal()
maven {
url "${artifactory_contextUrl}/${artifactory_repo}"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
mavenCentral()
}