gpt4 book ai didi

gradle - 使用Gradle构建可运行的jar Google数据流项目

转载 作者:行者123 更新时间:2023-12-03 05:51:43 27 4
gpt4 key购买 nike

我正在尝试使用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 Dataflow项目创建可运行的jar吗?

最佳答案

我们只使用distTar(它将包含您的JAR文件):

distTar {
compression = Compression.GZIP
mainClassName = '<main-class>'
applicationName = '<app-name>'
jar.baseName = applicationName
dependsOn('test')
}

关于gradle - 使用Gradle构建可运行的jar Google数据流项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47411713/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com