Skip to content

Plugin won't include a jar in another jar? #319

@Sushisource

Description

@Sushisource

Hi there. Great plugin. One problem:
I have a project with multiple subprojects. One of them is a server (cat) which contains the jar of another (agent) so that users can auto-download the client from the server when using our provided wrapper program.

I can't include the entire build scripts here, but these should be informative snippets:

In top-level build.gradle. This part works great in terms of making fat jars for all the subprojects we need and they execute OK.

subprojects { subproj ->
    // These projects need fat jars
    if (subproj.name in ["agent", "cat", "box", "commit-server"]) {
        apply plugin: 'application'
        apply plugin: 'com.github.johnrengelman.shadow'
        shadowJar {
            // Our jars are... pretty fat.
            zip64 true
            mergeServiceFiles()
            exclude 'META-INF/*.DSA'
            exclude 'META-INF/*.RSA'
            transform(AppendingTransformer.class) {
                resource = 'reference.conf'
            }
        }
    }
}

In the cat build.gradle:

sourceSets {
    main {
        resources {
            // Don't include every node module under the sun
            exclude 'node_modules/**/*'
            exclude '__tests__/**/*'
        }
    }
}

task copyAgentJar(type: Copy) {
    from project(':agent').shadowJar.archivePath
    into 'src/main/resources'
}
processResources.dependsOn(copyAgentJar)

This copy task works as expected. The agent fat jar ends up in the resources directory. The cat jar gets built with everything I expect in it except the agent jar file.

I would expect since it's just sitting there in my resources, and my resources source set by default includes everything in there except some specific things, that it'd end up in the shadow jar, but apparently no? Maybe I'm doing this in an awful way, but any tips would be much appreciated. Thanks!

Shadow Version 2.0.1

Gradle Version 4.1

Expected Behavior

agent--all.jar is included in cat.jar

Actual Behavior

It's not

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions