为什么我需要为我的构建存档配置uploadArchives和artifactoryPublish才能发布?

时间:2016-07-09 00:40:56

标签: gradle build.gradle artifactory gradle-release-plugin

我需要lib.zipmyApp.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 

0 个答案:

没有答案