Gradle artifactoryPublish is Skipped

Viewed 1449

I am trying to publish war files to our local artifactory server but when I run: ./gradlew clean build artifactoryPublish

I receive the following output:

:zuul-netflix-webapp:artifactoryPublish Skipping task ':zuul-netflix-webapp:artifactoryPublish' as task onlyIf is false. :zuul-netflix-webapp:artifactoryPublish SKIPPED

I've tried manually setting the onlyIf to true but this had no effect. I have tried similar configuration on another project and it works fine.

My environment:

17:22 $ ./gradlew --version

------------------------------------------------------------
Gradle 3.5.1
------------------------------------------------------------

Build time:   2017-06-16 14:36:27 UTC
Revision:     d4c3bb4eac74bd0a3c70a0d213709e484193e251

Groovy:       2.4.10
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_141 (Oracle Corporation 25.141-b15)
OS:           Mac OS X 10.11.6 x86_64

My build.gradle file looks like:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:2.2.0'


        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
        classpath 'org.akhikhl.gretty:gretty:2.0.0'
   } 
    configurations.classpath {
        resolutionStrategy {
           cacheDynamicVersionsFo r 0, 'seconds'
           cacheChangingModulesFor 0, 'seconds'
        }
    }
}

plugins {
    id 'nebula.netflixoss' version '3.4.0'
}

ext.githubProjectName = rootProject.name

configurations.all {
    // Exclude old asm 3.x versions.
    exclude group: 'asm', module: 'asm'
    exclude group: 'asm', module: 'asm-all'
}

allprojects {
    apply plugin: 'java'

    group = "com.netflix.${githubProjectName}"
    version = currentVersion  
    //status = 'Integration'
}

artifactoryPublish.skip = true

subprojects {
    artifactoryPublish.skip = false
    //artifactoryPublish.onlyIf { true }

    apply plugin: 'java'
    apply plugin: 'maven'
    apply plugin: 'maven-publish'
    apply plugin: 'ivy-publish'
    apply plugin: 'war'
    apply plugin: 'com.jfrog.artifactory'
    apply plugin: 'nebula.netflixoss'
    apply plugin: 'nebula.provided-base'

    dependencies {
        testCompile 'junit:junit:4.7'
    }

    repositories {
        jcenter()
    }

    sourceCompatibility = '1.7'
    targetCompatibility = '1.7'

    sourceSets.test.java.srcDir 'src/main/java'

    tasks.withType(Javadoc).each {
        it.classpath = sourceSets.main.compileClasspath
    }

    test {
        forkEvery = 1
        maxParallelForks = 1
    }

    publishing {
        publications {
            mavenJava(MavenPublication) {
                from components.web
            }

        }
    }

    artifactoryPublish {
        skip = false
        publications(publishing.publications.mavenJava)
    }
}


artifactory {
    //clientConfig.setIncludeEnvVars(true)
    //clientConfig.info.addEnvironmentProperty('test.adding.dynVar',new java.util.Date().toString())

    contextUrl = 'https://artifactory.oss.central1.com/artifactory'
    publish {
        repository {
            repoKey = 'libs-snapshot-local' // The Artifactory repository key to publish to
            username = "${artifactory_user}" // The publisher user name
            password = "${artifactory_password}" // The publisher password
            ivy {
              ivyLayout = '[organization]/[module]/ivy-[revision].xml'
              artifactLayout = '[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]'
              mavenCompatible = true //Convert any dots in an [organization] layout value to path separators, similar to Maven's groupId-to-path conversion. True if not specified
            }
        }
        defaults {
            // Reference to Gradle publications defined in the build script.
            // This is how we tell the Artifactory Plugin which artifacts should be
            // published to Artifactory.
            publications('mavenJava')
        }
    }
    resolve {
        repoKey = 'jcenter'
    }
}
0 Answers
Related