How to I rezip the subproject's jar, javadoc and source artifacts into all-in-ones?

(Tom Eugelink) #1

I’ve been able to setup my first multiproject, where each subproject upload its own artifact to Maven central (unfortunately I didn’t get the new maven-publish plugin working).

What I would like to do next, is create an “all-in-one” artifact; rezip all subproject’s main artifacts (so the jar, javadoc and sources) in three new artifacts, sign them and upload those as well.

I’ve been toying with subprojects and their configurations.archives.allArtifacts, but to no success. Any suggestions?

(Tom Eugelink) #2

Ok, let’s simplify it; just rezipping the main artifacts?

(Peter Niederwieser) #3

What exactly do you mean by that? One Jar containing the class files of all subprojects?

(Tom Eugelink) #4

Basically yes. I’ve got the project split up into four subprojects (so Internet-of-Things can pick what they want), but I’d still like for the desktop applications to offer a single jar.

The other approach would be to create an Maven artifact (typ epom) that depends on all subprojects.

(Peter Niederwieser) #5

Try something like:

task uberJar(type: Jar) {
    dependsOn { subprojects.jar }
    subprojects.each { proj ->
        from { zipTree(proj.jar.archivePath) }

(Tom Eugelink) #6

Hm, it does not give any errors, but no output either (I call it with gradle uberJar).

:uberJar (Thread[main,5,main]) started. :uberJar Skipping task ‘:uberJar’ as it is up-to-date (took 0.28 secs). :uberJar UP-TO-DATE :uberJar (Thread[main,5,main]) completed. Took 0.303 secs.

Will take some trail and error I guess.

(Tom Eugelink) #7

Ah, solved it, the resulting file is named “.jar”. Next step would be to rename it to jfxtras-all-8.0.jar and set that as the to be released artifact for uploadArchive

(Peter Niederwieser) #8

Add something like ‘appendix = “all”’ to the task configuration.