Closed DavidEGx closed 3 years ago
you are not supposed to run gradle
, but the ./gradlew
wrapper, as the each Elasticsearch release is usually only working with a limited set of gradle versions (the wrapper is using automatically the right version, nothing to do on your side).
The gradle versions you listed are years old and should not be used. It might be a good idea to not use the components shipped with your operating system as those are very likely outdated (again the gradle wrapper solves this problem for you with regards to gradle).
Thanks for the quick response. I'm not very familiar with gradle...
The gradle
in the 1st example is 7.0.2, seems to be relatively recent.
There is no gradlew
. Quick search tells me I need to run graddle wrapper
to get it, however:
gradle wrapper
FAILURE: Build failed with an exception.
* Where:
Build file '/home/david/ingest-awesome/build.gradle' line: 21
* What went wrong:
A problem occurred evaluating root project 'ingest-awesome'.
> Failed to apply plugin class 'org.elasticsearch.gradle.info.GlobalBuildInfoPlugin'.
> Installation is not valid. Original error message: A problem occurred starting process 'command '/usr/lib/jvm/openjdk-11/bin/java''
* 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
Oh, ./gradlew... Testing...
./gradlew clean check
=> error\o/
Not sure why after 3 kept failing. java -v
and javac -v
gave me the right Oracle version. However, ./gradlew still used the openjdk version for some reason.
Anyway, time to code something :)
Thanks!
pro tip, use something like sdkman or asdf to manage your java installations as a user... helps me a lot to switch between java versions
Thanks for the tip. I don't use have since the uni, and that was a long time ago... :D
Finally I made a working demo. However, there were a couple of issues in the process:
$ cookiecutter gh:spinscale/cookiecutter-elasticsearch-ingest-processor
You've downloaded /home/david/.cookiecutters/cookiecutter-elasticsearch-ingest-processor before. Is it okay to delete and re-download it? [yes]:
processor_type [awesome]:
package_dir [awesome]:
description [Ingest processor that is doing something awesome]:
developer_name [YOUR REAL NAME]:
elasticsearch_version [7.13.2]: 7.10.2
$ cd ingest-awesome/
$ ./gradlew clean check
FAILURE: Build failed with an exception.
* Where:
Build file '/home/david/ingest-awesome/build.gradle' line: 21
* What went wrong:
A problem occurred evaluating root project 'ingest-awesome'.
> Failed to apply plugin class 'org.elasticsearch.gradle.info.GlobalBuildInfoPlugin'.
> Could not create plugin of type 'GlobalBuildInfoPlugin'.
> Could not generate a decorated class for type GlobalBuildInfoPlugin.
> org/gradle/jvm/toolchain/JavaInstallation
* 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 insigh
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
It failed with other versions too, not only 7.10.2.
Workaround: I used latest version, opened zip file, changed version in plugin-descriptor.properties
, save zip.
$ /usr/share/elasticsearch/bin/elasticsearch-plugin install file:////home/david/ingest-awesome-0.0.1-SNAPSHOT.zip
-> Installing file:////home/david/ingest-awesome-0.0.1-SNAPSHOT.zip
-> Downloading file:////home/david/ingest-awesome-0.0.1-SNAPSHOT.zip
[=================================================] 100%
-> Failed installing file:////home/david/ingest-awesome-0.0.1-SNAPSHOT.zip
-> Rolling back file:////home/david/ingest-awesome-0.0.1-SNAPSHOT.zip
-> Rolled back file:////home/david/ingest-awesome-0.0.1-SNAPSHOT.zip
Exception in thread "main" java.lang.IllegalArgumentException: Unknown properties in plugin descriptor: [type]
at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:233)
at org.elasticsearch.plugins.InstallPluginCommand.loadPluginInfo(InstallPluginCommand.java:807)
at org.elasticsearch.plugins.InstallPluginCommand.installPlugin(InstallPluginCommand.java:866)
at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:254)
at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:224)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:91)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47)
Workaround: Build, opened zip file, remove type in plugin-descriptor.properties
, save zip, install.
Not sure if those are bugs or I'm simply doing something stupid. In any case, with those two workarounds it works just fine.
Very nice work btw, glad to have all the scaffolding in place and the unit tests <3
As there are constant changes in the Elasticsearch plugins/build-tools you need to go back to the commit supported 7.10.2 and go from there... that should make it work
Hi! Trying to run
gradle clean check
and it is failing miserably...I have tested it in 3 different environments:
Ubuntu 20.04.2 LTS openjdk version "11.0.11" 2021-04-20 Elastic 7.9.1 OSS Gradle 7.0.2
Debian GNU/Linux 10 (buster) openjdk version "11.0.11" 2021-04-20 Elastic 7.9.2 Gradle 4.4.1
Debian GNU/Linux 10 (buster) java version "16.0.1" 2021-04-20 Elastic 7.9.2 Gradle 4.4.1
Any hint? Any particular jvm version I should use? (Not including
--stracktrace
/--debug
to avoid this making this longer)