Build for 5.4.0

Hey @coutoPL, I’ve been trying to build for 5.4.0, but I get a Gradle issue. Have you tried?

18:49:27.763 [DEBUG] [org.gradle.configuration.project.BuildScriptProcessor] Timing: Running the build script took 35.857 secs
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter]
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter]
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter] * Where:
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter] Build file '/me/elasticsearch-readonlyrest-plugin-5.x/build.gradle' line: 40
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter]
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred evaluating root project 'readonlyrest'.
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter] > Failed to apply plugin [id 'carrotsearch.randomized-testing']
18:49:27.779 [ERROR] [org.gradle.BuildExceptionReporter]    > Could not generate a proxy class for class com.carrotsearch.gradle.junit4.RandomizedTestingTask.
18:49:27.780 [ERROR] [org.gradle.BuildExceptionReporter]
18:49:27.780 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
18:49:27.780 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
18:49:27.781 [LIFECYCLE] [org.gradle.BuildResultLogger]
18:49:27.781 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED

Been googling, deleted my .gradle cache and everything. No dice.
Do you have any Gradle tricks?

Hey, I have no idea what this is … but I’ll try to build it on my machine and will see what’s going on. But not today … I will back to the issue tomorrow evening.

1 Like

have the same error … it’s related to 5.4.0 elasticsearch.gradle build-tools. It looks like a bug. Don’t have workaround at the moment :frowning:

I’m more and more uncomfortable with depending on gradle + ES convoluted tooling. Which we are actually not using (as we are happy users of testcontainers).

AFAIK the only thing we are using of es build tools is the making of the zip file. Right?

you are right … maybe it’s time to migrate to sbt & scala and do not develop like animals any more :D:D:D

1 Like

Yeah I too, secretly dream about rewriting all this huge pile of Java in 1/10 lines of Scala :joy:
Notice how I symbolically marked your previous post as “THE SOLUTION” lol.

But before that, we need segregate the ES glue code really well and expose a neat API we can build on top, eventually in Scala.

Having said that, very soon today I will scan through your amazing PR which - incidentally - address exactly this aspect. :unicorn: :rocket:

ok, waiting for comments and suggestions.

I added a few comments, very satisfied overall. Much more structure, tidier everything. Thanks mate :clap:

No problem. Nice that I could help :slight_smile:
Next step is introducing modules. I don’t feel very comfortable with ES wiring parts, so I’ll create es53x and es52x modules in next PR, configure building and tests and let you port rest of supported versions in the same way. What do you think?

1 Like

I googled and seems that this is somewhat related to ES team using internal non-documented features of Gradle that break depending on which Gradle version you use. I managed to build 5.4.0 (with tests failing due to lack of docker on my system - it seems docker is used for some integration tests). It seems to work when using gradle 3.3, maybe with newer versions as well.

Anyhow here are my steps:

  • download latest version of Gradle (3.5) and make sure you are using it:
    gradle -v
    (should show 3.5)
  • create gradle wrapper that will use Gradle 3.3 for this build:
    gradle wrapper --gradle-version 3.3
  • run build without tests:
    ./gradlew updateSHAs check assemble -x test
1 Like

@knes1 came and saved the day. Quick, give a medal to this guy. :medal_military:

Can you make a pull request to change the gradle version? Travis CI will instantly test the docker stuff for you :slight_smile:

I gave it a shot.
I updated the the gradle wrapper and the dependencies (used in tests).
Now it builds, but tests fail in the Gradle integration (as it was built against 2.13)

ERROR   0.00s | LdapIntegrationSecondOptionTests (suite) <<< FAILURES!
   > Throwable #1: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle distribution ''.
   > 	at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(
   > 	at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(
   > 	at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(
   > 	at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$
   > 	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(
   > 	at org.gradle.internal.concurrent.StoppableExecutorImpl$
   > 	at java.util.concurrent.ThreadPoolExecutor.runWorker(
   > 	at java.util.concurrent.ThreadPoolExecutor$
   > 	at
   > 	at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(
   > 	at
   > 	at org.elasticsearch.plugin.readonlyrest.utils.gradle.GradleProjectUtils.runTask(
   > 	at org.elasticsearch.plugin.readonlyrest.utils.gradle.GradleProjectUtils.assemble(
   > 	at org.elasticsearch.plugin.readonlyrest.utils.containers.ESWithReadonlyRestContainer.create(
   > 	at org.elasticsearch.plugin.readonlyrest.utils.containers.ESWithReadonlyRestContainerUtils.lambda$create$0(
   > 	at org.elasticsearch.plugin.readonlyrest.utils.containers.MultiContainerDependent.starting(
   > 	at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(
   > Caused by: org.gradle.api.GradleException: Unable to start the daemon process.
   > This problem might be caused by incorrect configuration of the daemon.
   > For example, an unrecognized jvm option is used.
   > Please refer to the user guide chapter on the daemon at


@coutoPL is there something to update in GradleProjectUtils ?

Ok, I’ve seen you made the changes to the gradle wrapper recently so no need for PR :slight_smile:

I have one more small suggestion: Add the version of the gradle to be used for the build in gradle wrapper in file. That way you add a bit more explicitness regarding the required gradle version to build the system and, if in the future gradle needs to be updated, you just:

  1. increment the version
  2. run gradle wrapper to install new version of the wrapper.

To do this, add the following to

task wrapper(type: Wrapper) {
 gradleVersion = '3.5' 
1 Like

@sscarduzio I’ve seen the same error when I first run the build on my local machine but I’m not seeing it anymore. Since gradle runs a deamon on a first start and keeps it running for purpose of speeding up startup time when buliding again, there could be a chance a deamon from the old version of gradle somehows kept running.

I’m not too familiar with Travis, does it keep some files between the test runs? Since gradle deamon might not make sense in CI testing environment (e.g. you’re starting everything from scratch anyway) maybe you could add a flag --no-daemon to gradle (just see if that would help, or if the issue is somewhere else)? E.g. gradle --no-daemon … in bin/

It could also be this bug, and it’s triggered by new Gradle version:

If it’s that - then it fails because tmp directory in CI build environemnt doesn’t exist…

AFAIK it should not keep anything between builds. I never specified a gradle version for it to use either. Just checked the travis.yml and the settings. Nothing about gradle or environments.

Yeah… I checked out travis config and there’s nothing special in there that looks problematic :frowning:

As for gradle versions: you did actually implicitly specify gradle version through gradle wrapper. E.g. gradle version you used is embedded in the gradle wrapper (which is a gradle binary that’s packed together with the project so that one can use the same build system everytime consistently without need to actually download gradle - it’s located in ./gradle/wrapper). Up until last update you used 2.13 (see history of

The could theoretically still be the issue, although, that would mean that almost none of the gradle projects would work in Travis without special config of temp directory, which I doubt is the case (there’d be far more references to it on the internet if it were).

It’s really strange though that the issue still pops out even when --no-daemon option is used. :frowning:

The --no-deamon affects the command line launch, then some of the tests interact with gradle as a library and call the assemble task. And there is where it fails. I’m not sure how to disable daemon from the programmatic side.

Aaaa, so tests depend on gradle. This could be the culprit then (in build.gradle):

testCompile 'org.gradle:gradle-tooling-api:2.13’
testRuntime ‘org.gradle:gradle-tooling-api:2.13’

This should probably be updated to 3.5.

Yes, that’s why I changed it (see the current)