我需要lib.zip
和myApp.war
发布到artifactory
。
最初,我从artifactoryPublish
开始,希望当我跑步时
./gradlew clean release
,战争和邮政被发布为神器。但我只观察到战争上传了。我不得不在我的build.gradle中添加包含此附加内容以获取zip和war上传
afterReleaseBuild.dependsOn uploadArchives
。为什么我需要两者?
如果我删除afterReleaseBuild.dependsOn artifactoryPublish
,则不会上传/发布任何内容。
这是我的build.gradle
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:+"
classpath 'net.researchgate:gradle-release:2.+'
}
}
allprojects {
apply plugin: "com.jfrog.artifactory"
apply plugin: 'net.researchgate.release'
apply plugin: "java"
apply plugin: "maven"
apply plugin: "war"
group 'com.example.services'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
war {
archiveName = "myApp.war"
}
task wrapper(type: Wrapper) {
gradleVersion = '2.11'
}
task buildAssets(type: Zip) {
baseName = 'lib'
version = null
from('libs/') {
include '**/*.jar'
}
assemble.dependsOn(buildAssets)
artifacts {
archives buildAssets
}
release {
git {
requireBranch = ''
}
}
afterReleaseBuild.dependsOn uploadArchives
afterReleaseBuild.dependsOn artifactoryPublish
artifactory {
contextUrl = "http://myartifatoryurl"
publish {
repository {
repoKey = 'libs'
maven = true
username = "foo"
password = "bar"
}
defaults {
publishConfigs ('archives')
}
}
resolve {
repository {
repoKey = 'releases'
maven = true
username = 'foo'
password = 'bar'
}
}
}
//rest of dependencies here