jar amazon-kinesis-connectors 正在使用 amazon-kinesis-client 。我想将此依赖项更改为本地自定义jar:
dependencies {
compile ('com.amazonaws:amazon-kinesis-connectors:1.2.0'){
exclude group: "com.amazonaws", module: "amazon-kinesis-client"
}
compile files('libs/amazon-kinesis-client-1.6.3.jar')
//...
}
编译好,但是当我运行代码时,我得到 java.lang.NoClassDefFoundError:com / amazonaws / services / kinesis / clientlibrary / interfaces / IRecordProcessorFactory 。有没有办法在gradle中进行这种依赖管理?
作为我正在使用的环境:
编辑:
intellij中的使用gradle任务运行:
task run_app(type:JavaExec) {
main = 'org.main.RunApp'
classpath = sourceSets.main.runtimeClasspath
}
答案 0 :(得分:1)
尝试以下gradle配置
dependencies {
compile ('com.amazonaws:amazon-kinesis-connectors:1.2.0'){
exclude group: "com.amazonaws", module: "amazon-kinesis-client"
}
compile files('libs/amazon-kinesis-client-1.6.3.jar')
runtime files('libs/amazon-kinesis-client-1.6.3.jar')
//...
}
或者您可以使用应用程序插件来创建可执行jar
https://docs.gradle.org/current/userguide/userguide_single.html#application_plugin