The gradle wrapper usually generates (besides from other files) the scripts gradlew
and gradlew.bat
. Because this project is done exclusively under Linux, there is no need for gradlew.bat
. Therefore, I would like the gradle wrapper not to generate it in the first place.
Because was not able to achieve this, I tried to delete the file after each call to the wrapper task. To this purpose I created a task wrapperWithoutWin
that depends on the wrapper task and deletes gradlew.bat
. This task should now be called instead of the wrapper task.
Unfortunately, wrapperWithoutWin
does delete an existing gradlew.bat
file, but this is generated afterwards by the wrapper task. My understanding was that the dependency task (in this case the wrapper task) should be executed before the depending task (wrapperWithoutWin
). Somehow this does not work as expected.
My two questions are:
-
How can one prevent the wrapper from generating
gradlew.bat
? -
And (because I find this an interesting question as well, even if the first one is solved) how can one run tasks after the wrapper task?
task wrapper(type: Wrapper) { gradleVersion = "4.2.1" } task wrapperWithoutWin(dependsOn: "wrapper") { println file("${projectDir}/gradlew.bat").exists() delete "${projectDir}/gradlew.bat" println file("${projectDir}/gradlew.bat").exists() }