kam*_*mal 4 groovy uberjar gradle
我在{project_home} / src / test / groovy /中进行了一些功能测试
我希望能够使用gradle任务:
使用{project_home} / src / test / groovy /下的所有.groovy文件(包括所有依赖项)制作一个jar文件
能够运行此jar文件来代替运行单个groovy文件
我遇到的所有示例都有一个main方法,而我没有main()
所以我试图使用“项目的” build.gradle并附加
task fatJar(type: Jar) {
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
Run Code Online (Sandbox Code Playgroud)
跑了 $gradle clean fatJar
但是编译失败:
: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
Run Code Online (Sandbox Code Playgroud)
我确实在/ build / libs下有jar文件
task uberJar(type: Jar,dependsOn:[':compileGroovy']) {
zip64 true
from files(sourceSets.main.output.classesDir)
from configurations.runtime.asFileTree.files.collect {zipTree(it) }
with jar
}
Run Code Online (Sandbox Code Playgroud)
解决了这个问题。
归档时间: |
|
查看次数: |
1629 次 |
最近记录: |