Hi everyone
I’m new to the world of gradle, I was previously on the maven land.
I found Gradle to be powerful and complex, but I want to learn
I want to make a fat jar with tests classes and dependencies, a fat test jar
So far, I have done a fatJar with compile classes and dependiencies and a test jar with only test classes.
I’ve tried many configurations and options, but I didn’t hit the nail
My configuration gradle file is
//THIS WORKS
task fatJar(type: Jar) {
dependsOn install
manifest {
attributes 'Manifest-Version': '1.0', 'Implementation-Title': 'xyz', 'Implementation-Version': version, 'Main-Class': 'ClientMain', 'SplashScreen-Image': 'splashScreen.png'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
// THIS ALSO WORKS
task testJar(type: Jar) {
manifest {
attributes 'Manifest-Version': '1.0', 'Implementation-Title': 'xyz', 'Implementation-Version': version, 'Main-Class': 'TestMain', 'SplashScreen-Image': 'splashScreenTest.png'
}
//classifier = 'tests'
baseName = project.name + '-test'
from sourceSets.test.output+sourceSets.test.allSource
}
// THIS NOT WORK
// Generates a Jar but without test classes and resources
task fatTestJar(type: Jar) {
dependsOn testJar, fatJar
manifest {
attributes 'Manifest-Version': '1.0', 'Implementation-Title': 'xyz', 'Implementation-Version': version, 'Main-Class': 'TestServer', 'SplashScreen-Image': 'splashScreenTest.png'
}
baseName = project.name + '-test-all'
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
configurations.testCompile.collect { it.isDirectory() ? it : zipTree(it) }
sourceSets.test.output
}
with jar
}
Anyone has a clue ?
Thanks