Reputation: 9785
i have some functional tests in {project_home}/src/test/groovy/
i want to be able to use a gradle task to:
Make a jar file from all the .groovy files under {project_home}/src/test/groovy/ including all of the dependencies
be able to run this jar file as a substitute of running individual groovy files
All the example i came across have a main method , the one i have have no main()
so i tried to use the "Project's" build.gradle and appended
task fatJar(type: Jar) {
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
and ran $gradle clean fatJar
but got compile failure:
:Tests:EndToEndFunctionalTests:fatJar FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Tests:EndToEndFunctionalTests:fatJar'.
> archive contains more than 65535 entries.
To build this archive, please enable the zip64 extension.
See: https://docs.gradle.org/2.7/dsl/org.gradle.api.tasks.bundling.Zip.html#org.gradle.api.tasks.bundling.Zip:zip64
i do have the jar file under /build/libs
Upvotes: 4
Views: 2507
Reputation: 9785
task uberJar(type: Jar,dependsOn:[':compileGroovy']) {
zip64 true
from files(sourceSets.main.output.classesDir)
from configurations.runtime.asFileTree.files.collect {zipTree(it) }
with jar
}
Solved the issue.
Upvotes: 6