Uploading fatjar with uploadArchives

I am going to upload a fatjar file with uploadArchives.

task fatJar(type: Jar, dependsOn: ['createPom']) {
    classifier 'fat'
    group = 'build'
    description = 'Assembles a jar archive containing the main classes and all dependent classes.'
    jar.dependsOn << fatJar
    manifest { 
        from sharedManifest
    }
    baseName = project.name + '-all'
    from (sourceSets.main.output.classesDir)
    from (configurations.json.collect {zipTree(it)})
} 

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: uri('../repo')) 
        }
        mavenLocal()
    }
}

I only found this related post:
https://github.com/musketyr/gradle-fatjar-plugin/issues/15

which didn’t work on me.

1 Like

Have you tried adding the fatJar to the list of artifacts? https://docs.gradle.org/current/userguide/artifact_management.html#N15B0B

Thank you Sterling, I found a way to do that. classifier ‘fat’ which is inside of fatjar class did the trick.