I'm trying to make an executable program file to distribute of my java program. Normally I would make this file by running:
$ echo '#!/usr/bin/java -jar' > program
$ cat my-program.jar >> program
$ chmod +x program
As far as I can tell Gradle is supposed to be able to make distributions of software. I'm not sure if this extends to making Operating System releases or if it's just files to be used by package maintainers. as covered here
I would like to be able to have Gradle prepare distribution files for making packages. Something like this:
distributions
└── project_1.1-1
└── Folder
├── control
└── usr
└── local
└── bin
└── program
So far I have tried this in build.gradle
:
distributions {
write '#!/usr/bin/java -jar'
into program
Jar {
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll {
it.name.endsWith('jar') }.collect { zipTree(it) }
}
}
} into program
}