I am using Gradle for my Java project, and I was wondering if it is possible to prevent the gradle build
jar file from being generated every time it is executed.
Also, is it possible to create a custom task to create Jar with dependencies in a specific place build/myAppJar/
.
Here is what I have done so far for a custom task:
task toJar (type: Jar) {
from configurations.compile.collect { zipTree it }
manifest {
attributes 'Implementation-Title': 'myApp',
'Implementation-Version': 1.0,
'Main-Class': mainClassName
}
}
The above code will create a jar file under build/libs
, and the file does not contain compiled files, but only dependencies.
Thank!
source
share