[root@VM_63_147_centos logstash-input-java_input_example]# ./gradlew gem Starting a Gradle Daemon (subsequent builds will be faster) FAILURE: Build failed with an exception. * Where: Build file '/data/logstash-input-java_input_example/build.gradle' line: 101 * What went wrong: A problem occurred configuring root project 'logstash-input-java_input_example'. > Could not create task ':gem'. > No signature of method: org.gradle.api.internal.tasks.DefaultTaskDependency$TaskDependencySet.getAt() is applicable for argument types: (ArrayList) values: [[task ':downloadAndInstallJRuby', task ':removeObsoleteJars', ...]] Possible solutions: getAt(int), getAt(java.lang.String), getAt(java.lang.String), head(), putAt(java.lang.String, java.lang.Object), wait() * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 12s
官网教程:https://www.elastic.co/guide/en/logstash/current/java-input-plugin.html
官网下载的logstash 最新版源码:https://github.com/elastic/logstash/tree/7.10
构建logstash源码:
gradlew assemble
查看是否有:$LS_HOMElogstash-coreuildlibslogstash-core-7.10.1.jar
编写Logstash Java input代码
下载官方demo:logstash input example:https://github.com/logstash-plugins/logstash-input-java_input_example
指定LOGSTASH_CORE_PATH
下载下来demo后,在项目根目录创建gradle.properties
文件,
添加一行数据: LOGSTASH_CORE_PATH=<执行gradlew assemble 后logstash编译出来的核心jar包>/logstash-core
gradlew gem
在此处出现错误:No signature of method: org.gradle.api.internal
编辑 build.gradle
tasks.register("gem"){ dependsOn [downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles] doLast { buildGem(projectDir, buildDir, pluginInfo.pluginFullName() + ".gemspec") } } ################上面修改为######################## tasks.register("gem"){ dependsOn ([downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles]) doLast { buildGem(projectDir, buildDir, pluginInfo.pluginFullName() + ".gemspec") } }
这样gradle就能识别了