Failed to run multiple gradle commands

I’m using gradle also to run my applications. One via a JavaExec task:

gradle run --no-daemon and another one via jettty run war (at the same time):

gradle jettyRunWar --no-daemon

With gradle version 1.0 milestone 3 this was possible, but with milestone 5 I get: FAILURE: Build failed with an exception.

  • What went wrong: Could not open cache directory /home/abc/.gradle/1.0-milestone-5-20110930174101+0200/taskArtifacts. Cause: Timeout waiting to lock cache directory /home/abc/.gradle/1.0-milestone-5-20110930174101+0200/taskArtifacts. It is currently in use by another Gradle instance. Owner PID: 25585 Our PID: 25558 Owner Operation:

Our operation:

Lock file: /home/abc/.gradle/1.0-milestone-5-20110930174101+0200/taskArtifacts/cache.properties.lock

This is GRADLE-1801.

Hi Peter,

You just need to manually delete the rogue lock file when this happens:

rm /home/abc/.gradle/1.0-milestone-5-20110930174101+0200/taskArtifacts/cache.properties.lock

This is an issue we are aware of and will be fixed,

Thx for the reply. I’m back to milestone 3 for the moment and will try milestone 5 again when this is fixed.

Please has this been fixed? I am using gradle milestone 6 and appear to be running into the same issue, though the reason for the failure is well highlighted.

I have two web application, one makes use of the other and trying to run both of them from the command line seems impossible.

On the first web app, I am able to start the server fine using gradle jettyRun. On the second web app (after the first one has been started), if I invoke gradle jettyRun, it hangs for a while and later reports this error.

FAILURE: Build failed with an exception.

  • What went wrong: Could not open cache directory /Users/berinle/projects/sandbox/rebel-bug/.gradle/1.0-milestone-6/taskArtifacts. Cause: Timeout waiting to lock cache directory /Users/berinle/projects/sandbox/rebel-bug/.gradle/1.0-milestone-6/taskArtifacts. It is currently in use by another Gradle instance. Owner PID: 10348 Our PID: 10215 Owner Operation:

Our operation:

Lock file: /Users/berinle/projects/sandbox/rebel-bug/.gradle/1.0-milestone-6/taskArtifacts/cache.properties.lock

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Deleting the lock file and re-attempting doesn’t fix the issue.

Thanks.

This is fixed: GRADLE-1801.

You can use a recent milestone-7 snapshot to pick up the fix: http://repo.gradle.org/gradle/distributions-snapshots/gradle-1.0-milestone-7-20111209194225+0100-bin.zip

milestone-7 will be released soon.

Thanks Adam. milestone-7 snapshot does the trick.

I have a buildSrc folder in my (multi)project which contains build logic. When running a concurrent build with gradle-1.0-milestone-7-20111228012857+0100, i still get a timeout on the lock:

FAILURE: Build failed with an exception.

  • What went wrong: Could not open cache directory buildSrc (/prg/projects/hydra\buildSrc/.gradle/noVersion/buildSrc). Cause: Timeout waiting to lock cache directory buildSrc (/prg/projects/hydra/buildSrc/.gradle/noVersion/buildSrc). It is currently in use by another Gradle instance. Owner PID: 1860 Our PID: 352 Owner Operation: Our operation: Lock file: /prg/projects/hydra/buildSrc/.gradle/noVersion/buildSrc/cache.properties.lock

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I suppose GRADLE-1801 hasn’t been tested with a project that has a /buildSrc folder? Should i create a separate issue for this, or is it an “overlooked” part of GRADLE-1801?

Interesting to see is that the lock file gradle attempts to lock is located in buildSrc/.gradle/noVersion, rather than buildSrc/.gradle/1.0-milestone-7-20111228012857+0100/