I am trying to create an executable with Launch4J with my obfuscated jar but I have a problem. Every time I run the createEXE
task via Gradle, the shadowJar task also runs causing my obfuscated jar to be overwritten.
How to I use my obfuscated jar with Launch4J's createExe
task? Otherwise how do I stop shadowJar
from running during the execution of createExe
?
Here is my Launch4J task:
launch4j {
jar = "${projectDir}/build/libs/plugin.jar"
outfile = 'Plugin.exe'
icon = "${projectDir}/etc/icon.ico"
mainClassName = 'plugin.Driver'
bundledJrePath = './jre'
jreMinVersion = '1.8.0_161'
jdkPreference = 'preferJdk'
}
You should just ignore the shadowJar
task using the -x
option. It tells Gradle to skip the specified task.
gradle -x shadowJar createExe
You can also do permanently like that :
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(createExe)) {
shadowJar.enabled = false
}
}