Custom extension with artifactoryPublish task


(Casey Rogers) #1

I’m using gradle’s publish functionality to push a tar.gz file to artifactory but when it lands in artifactory it’s only providing the .gz extension instead of tar.gz. Is there a way to specify the extension?

artifactory {
    contextUrl = "${artifactory_contextUrl}"
    publish {
        repository {
            repoKey = repo
            username = "${artifactory_user}"
            password = "${System.env.ARTIFACTORY_PASSWORD}"
        }
        defaults {
            publications ('mavenJava')
        }
    }
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            version = newVersion;
            groupId "com.sample.loc"
            artifactId jar.baseName
            artifact file( "build/distributions/${jar.baseName}-${newVersion}.tar.gz" )
        }
    }
}

(Mark Vieira) #2

By default we just treat everything after the last . as the extension. You can set this explicitly though.

artifact("build/distributions/${jar.baseName}-${newVersion}.tar.gz"), {
    extension = 'tar.gz'
}