Create zip with a file from jar and another jar from project directory

I want to create a zip archive containing a file from the plugin.jar file and a jar from from build/libs directory. The build looks like this

plugins {
    id "base"
    id "java"
}

task zip_service(type: Zip){
    dependsOn build

    from "build/libs" include "*.jar"
    from zipTree("in/plugin.jar").matching{
        include "resources/installation.sh"
        eachFile { fcd ->
            fcd.relativePath = new RelativePath(true, fcd.relativePath.segments.drop(1))
        }
        includeEmptyDirs = false
    }

    archiveName "zipArchive.zip"
    destinationDir(buildDir)
}

Either from statement alone works fine. A zip is created with the expected files. However when both from statements are present the zip is invalid. It appears empty even though its size is not 0 bytes.

Any help on how to resolve this problem is greatly appreciated .

eachFile and includeEmptyDirs are methods on the zip task, not a method on zipTree so your snippet above is actually

task zip_service(type: Zip){
    dependsOn build

    from "build/libs" include "*.jar"
    from zipTree("in/plugin.jar").matching{
        include "resources/installation.sh"       
    }
    eachFile { fcd ->
        fcd.relativePath = new RelativePath(true, fcd.relativePath.segments.drop(1))
    }
    includeEmptyDirs = false
    archiveName "zipArchive.zip"
    destinationDir(buildDir)
}