我的build.gradle
进行了以下更改,以构建warfile并解决来自 Artifact 的依赖关系:
buildscript {
repositories {
maven {
url 'http://localhost/artifactory/plugins-release'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.1.1')
}
configurations {
warLib {
transitive=false
}
}
}
war {
classpath configurations.warLib
classpath = classpath.files
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = ‘aaa'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publications('mavenJava')
publishPom = false
}
}
resolve {
repository {
repoKey = ‘aba'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
当我尝试构建此代码时,出现错误:
为了解决该错误,我添加了以下内容:
repositories {
maven {
url 'http://localhost/artifactory/aba'
}
}
注意
这意味着 Artifact 中的resolve选项无法解析,我认为这是因为我构建war文件的方式。我该如何解决它,以便可以构建war文件并使用 Artifact 中的resolve选项?
最佳答案
您忘记了使用artifactory
插件:apply plugin: "com.jfrog.artifactory"
关于gradle - 更新build.gradle以构建一个jar文件并将其推送到 Artifactory ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34141068/