Calling Two JavaExec Tasks on two command prompts causing a failure

I get the following error when I execute two different JavaExce tasks in two different command prompts. Both the tasks are defined in the same .gradle. One is a task to start my app and another to stop.

C:\projects\optimize>gradlew stop Using Gradle home…C:\Users\krik.gradle\gradle-1.0-milestone-9 Using Gradle user home…C:\Users\krik.gradle

FAILURE: Build failed with an exception.

  • What went wrong: Could not open cache directory buildSrc (C:\projects\optimize\buildSrc.gradle\n oVersion\buildSrc). > Timeout waiting to lock cache directory buildSrc (C:\projects\optimize\buildSr c.gradle\noVersion\buildSrc). It is currently in use by another Gradle instance .

Owner PID: 2204

Our PID: 7864

Owner Operation:

Our operation:

Lock file: C:\projects\optimize\buildSrc.gradle\noVersion\buildSrc\cache.prop erties.lock

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

BUILD FAILED

Total time: 1 mins 4.058 secs

This is a known issue: http://issues.gradle.org/browse/GRADLE-2032. Thanks for the report.

I have custom tasks in buildSrc directory and so I can’t accept the solution of removing the buildSrc. Is there any other work around?

Moved all my build custom tasks to utility classes and removed buildSrc directory. I still see same issue with start and stop of java application. Project run-time classpath is the main reason to have gradle JavaExec task to start and stop my app. Any other suggestions?