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

**URL:** https://discuss.elastic.co/t/logstash-java-filter-plugin-example-gradlew-gem-error/257110
**Category:** Logstash
**Created:** [November 30, 2020, 6:09pm UTC](https://discuss.elastic.co/t/logstash-java-filter-plugin-example-gradlew-gem-error/257110 "2020-11-30T18:09:07Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![lakechat](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lakechat](https://discuss.elastic.co/u/lakechat)
#### Post date: [November 30, 2020, 6:09pm UTC](https://discuss.elastic.co/t/logstash-java-filter-plugin-example-gradlew-gem-error/257110/1 "2020-11-30T18:09:07Z")

</div>

I was following Elasticsearch document ([https://www.elastic.co/guide/en/logstash/current/java-filter-plugin.html](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.

---

<div class="post-metadata">

### Author: ![paul.devereux](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@paul.devereux](https://discuss.elastic.co/u/paul.devereux)
#### Post date: [December 1, 2020, 11:12am UTC](https://discuss.elastic.co/t/logstash-java-filter-plugin-example-gradlew-gem-error/257110/2 "2020-12-01T11:12:17Z")

</div>

Hi,

You need to change line 102 from

dependsOn [downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles]

to

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

Regards

---

<div class="post-metadata">

### Author: ![lakechat](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lakechat](https://discuss.elastic.co/u/lakechat)
#### Post date: [December 1, 2020, 6:01pm UTC](https://discuss.elastic.co/t/logstash-java-filter-plugin-example-gradlew-gem-error/257110/3 "2020-12-01T18:01:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Cnu311](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cnu311/32/81940_2.png) [@Cnu311](https://discuss.elastic.co/u/Cnu311)
#### Post date: [December 2, 2020, 3:02pm UTC](https://discuss.elastic.co/t/logstash-java-filter-plugin-example-gradlew-gem-error/257110/4 "2020-12-02T15:02:37Z")

</div>

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

> <https://github.com/elastic/logstash/blob/master/rubyUtils.gradle>

---

<div class="post-metadata">

### Author: ![lakechat](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lakechat](https://discuss.elastic.co/u/lakechat)
#### Post date: [December 3, 2020, 12:18am UTC](https://discuss.elastic.co/t/logstash-java-filter-plugin-example-gradlew-gem-error/257110/5 "2020-12-03T00:18:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 31, 2020, 12:19am UTC](https://discuss.elastic.co/t/logstash-java-filter-plugin-example-gradlew-gem-error/257110/6 "2020-12-31T00:19:12Z")

</div>

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