我正在尝试使用Gradle从Google Dataflow项目构建一个可运行的jar。
我刚刚在build.gradle
中添加了此代码以导出jar:
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Deepmind Jar File',
'Implementation-Version': version,
'Main-Class': 'MyMainClass'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
我曾尝试使用示例主类来导出jar,但它运行正常。 但是当我应用包含google dataflow管道的主类时,运行jar文件后,我收到了一个错误:
Exception in thread "main" java.lang.IllegalStateException: Unable to return a default Coder for Transform: UsersNormalize/RemoveDuplication: usersDailyCollection/Format: usersDailyNormalize/ParMultiDo(Anonymous).out0 [PCollection]. Correct one of the following root causes:
No Coder has been manually specified; you may do so using .setCoder().
Inferring a Coder from the CoderRegistry failed: Unable to provide a Coder for com.google.api.services.bigquery.model.TableRow.
Building a Coder using a registered CoderProvider failed.
See suppressed exceptions for detailed failures.
Using the default output Coder from the producing PTransform failed: Unable to provide a Coder for com.google.api.services.bigquery.model.TableRow.
Building a Coder using a registered CoderProvider failed.
See suppressed exceptions for detailed failures.
有人可以帮助解决这个问题或建议如何为google数据流项目创建一个可运行的jar吗?
答案 0 :(得分:0)
我们只使用distTar
(包含您的JAR文件):
distTar {
compression = Compression.GZIP
mainClassName = '<main-class>'
applicationName = '<app-name>'
jar.baseName = applicationName
dependsOn('test')
}