Hello,
I am repeating a question of Jared D. Cotrell from April 2011 to the mailing list: > How do I do the equivalent of Ant’s whenmanifestonly=“skip” using the > Gradle java plugin’s jar task? > >
<jar jarfile=“lib/${module}.jar” >
basedir="${build}" >
whenmanifestonly=“skip” />
See nabble
I stumbled over the same issue. My intermediate solution is
jar {
onlyIf{ !compileJava.source.empty }
}
I feel this is akward because it firstly duplicates the indirect task dependency compileJava (-> classes) -> jar and secondly has to be repated for each task of type Jar. Actually for this second point I have no clue how to write it as
tasks.withType(Jar) {
onlyIf{ /* what to write here? */ }
}
Environment: java and war plugin.
Any ideas how to improve this situation?