I have a sub-project lombok-anno
to extends lombok lib, with a user-gen dir $buildDir/lombok
, which is used for compile lombok-anno
, and added to mainsourceset.output, but not needed (neather run or compile) for another sub-project main-proj
who uses lombok-anno
.
the default behavior of JavaPlugin’s jar task will add all main.output to xxx.jar ( by call from(output) ).
so i need to customize the jar task, to remove $buildDir/lombok
in Jar.source
- because the exclude uses path in des_path in jar, not source path in from, so it failes. The file in jar is mixed, hard to exclude.
tasks.named("jar"){
exclude "$buildDir/lombok"
}
- not work, the source added by JavaPlugin’s jar not removed.
tasks.replace("jar", Jar).configure{
println source.getFiles()
}
How to customize the jar task?