Gradle 更新build.grade以生成WAR文件并将其推送到artifactory
MyGradle 更新build.grade以生成WAR文件并将其推送到artifactory,gradle,build.gradle,artifactory,Gradle,Build.gradle,Artifactory,Mybuild.gradle对构建WAR文件和从artifactory解析依赖项进行了以下更改: buildscript { repositories { maven { url 'http://localhost/artifactory/plugins-release' credentials { username = "${artifactory_user}"
build.gradle
对构建WAR文件和从artifactory解析依赖项进行了以下更改:
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
}
}
}
当我尝试构建此代码时,我得到一个错误:
无法解析外部依赖项abc:1.0.0,因为未定义存储库
为了修复错误,我添加了以下内容:
repositories {
maven {
url 'http://localhost/artifactory/aba'
}
}
注
这意味着artifactory中的resolve选项没有解析,我认为这是因为我构建war文件的方式。如何修复它,以便构建war文件并使用artifactory的resolve选项?您忘记应用
artifactory
插件:
应用插件:“com.jfrog.artifactory”
我也应用了该插件。这并没有提供问题的答案。若要评论或要求作者澄清,请在其帖子下方留下评论。-@AmirHosseinMehrvarzi这不是作者请求的澄清,这是答案。生成失败是因为作者忘记应用插件。@Jason它不在您的生成脚本中。@JBaruch,这可能是我正在使用的grade版本(当前为2.6)的问题,因为我确实应用了artifactory插件。