I have added exclude
statement but still my exclude abc/object/MyTestConfig*.class
are getting added in jar, any reason why ?
jar {
zip64 true
from((configurations.compile - configurations.jarDepends).collect { it.isDirectory() ? it : zipTree(it) }) {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
from ("$projectDir/src/main/java/") {
include "**/*.hbm.xml",
"abc/tools/xml/XMLClasses.MF"
exclude "abc/object/MyTestConfig*.class"
}
}
task filterVersionConstants(type: Copy) {
from "src/main/java/abc/"
into "src/main/java/abc/"
include "VersionConstants.tmpl"
exclude "**/MyTestConfig*.class"
rename { String fileName ->
fileName.replace('.tmpl', '.java')
}
After couple of trial and error, finally I'm able to exclude this file from my jar as below. Basically I need to pull exclude statement in jar
task at first.
jar {
zip64 true
exclude "abc/object/MyTestConfig*.class"
from((configurations.compile - configurations.jarDepends).collect { it.isDirectory() ? it : zipTree(it) }) {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
from ("$projectDir/src/main/java/") {
include "**/*.hbm.xml",
"abc/tools/xml/XMLClasses.MF"
}
}