Logstash Java filter plugin example "./gradlew gem" error

I was following Elasticsearch document (https://www.elastic.co/guide/en/logstash/current/java-filter-plugin.html) to write a Java filter plugin for Logtash. Somehow, I could not even get the provided example work. I stuck at " ./gradlew gem" stage. Here is the error message:

FAILURE: Build failed with an exception.
** Where:*
Build file '/Users/taoli/Documents/java_code/logstash-filter-java_filter_example/build.gradle' line: 102
** What went wrong:*

A problem occurred configuring root project 'logstash-filter-java_filter_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()

I have plugin project and Logstash project in two different folders, and added gradle.properties file in the plugin project with value

LOGSTASH_CORE_PATH=/Users/taoli/Documents/java_code/logstash_src/logstash-core

I suspect that in build.gradle file, something wrong with this line:

apply from: LOGSTASH_CORE_PATH + "/../rubyUtils.gradle"

Because when I tried with "./gradlew build", it complained that it could not find all Logstash api methods.

Hi,

You need to change line 102 from

dependsOn [downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles]

to

dependsOn([downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles])

Regards

Hi Paul,

Thanks for the response. It did let me move forward by downloading required libraries. But "compileJava" task still fails. It could not find the Logstash apis. So I guess this statement failed:

apply from: LOGSTASH_CORE_PATH + "/../rubyUtils.gradle"

Any idea what went wrong?

Thanks.

Hi,
I faced the same issue. I found this file (link provided below) and used in my path.

Hi,

I am able to compile, build and install gem now. Here are what happened:

  1. In plugin project, modify build.gradle line 102, add '()" as pointed out by Paul
  2. In the same file, for this line
    implementation fileTree(dir: LOGSTASH_CORE_PATH, include: "build/libs/logstash-core-?.?.?.jar")

it seems not working, so I just replace it with direct path, like this

implementation files('/Users/test/workspace/logstash/logstash-core/build/libs/logstash-core-7.10.1.jar')

  1. It requires JDK to install gem. Somehow, only JDK 8.0 works for me.

Hope these help.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.