badass-runtime-plugin icon indicating copy to clipboard operation
badass-runtime-plugin copied to clipboard

runtimeZip ignores additional or modified files in imageDir

Open goatfryed opened this issue 5 years ago • 1 comments

I want to modify the runtime image. I need to place a couple of additional files into the image directory that should not be placed in the jars, because you user might want to modify them.

The first thing I'm trying to tweak is the conf/logging.properties files with better defaults. Therefore, I defined the following task

task tweakImage (type: Copy) {
    dependsOn tasks.named("runtime")

    doLast {
        from "$projectDir/dist/logging.properties"
        into "$buildDir/image/conf/"
    }
}

tasks.named("runtimeZip") {
    it.dependsOn(tweakImage)
}

While the image directory looks as expected, the resulting zip contains no logging.properties file in the conf dir at all. Neither the original one, nor my modified version.

Is there a better way do modify the image? Why are modified files ignored?

I also tried to add doLast to the runtime task, but that introduced other gradle UP-TO-DATE issues.

goatfryed avatar Jan 20 '21 11:01 goatfryed

Since I'm not using jpackage, I've simply added my own zip task now

runtimeZip.enabled(false)

task runtimeZipPatched (type: Zip) {
    group "build"
    dependsOn tasks.named("runtime")

    archiveFileName = "printandpack.zip"
    into("/") {
        from { runtime.imageDir }
        exclude "conf/logging.properties"
    }
    into("/conf") {
        from "$projectDir/dist/logging.properties"
    }
}

I assume this needs more effort, when working with jpackage. Please let me know if there is a better way to modify the zip task. This feels kinda dirty

goatfryed avatar Jan 20 '21 12:01 goatfryed