Hello,
I’d like to override behavior of gradle’s “jar” task such that it puts the generated .jar file into a different directory.
The reason why I want to override the “jar” task rather than explicitly call it with the destinationDir property value is so that the .jar file is automatically delivered to the right directory when the “jar” task gets called as part of other gradle build project dependencies.
So, I tried something like this:
task jar(overwrite: true, type: Jar, dependsOn: classes) << {
println “Runing custom Jar”
destinationDir = new File(“myLib”) }
When I execute such overwritten “jar” task, here are two things I’m noticing
- .jar file still gets generated in its default location, and it only contains the MANIFEST file with no source compiled classes 2. nothing gets put into “myLib” directory I referenced above
Thanks.