Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle + Intellij IDEA 13 bug

I'm trying to setup simple webapp with gradle 1.7, jetty 9.2 and intellij IDEA 13.

Here some typical config lines of gradle build found in tutorials I'm using:

apply plugin: 'jetty'

sourceCompatibility = 1.5
version = '1.1'

repositories {
    mavenCentral()
}

dependencies {
    providedCompile 'javax.servlet:servlet-api:2.5'
    // other dependencies
}

Configuration to launch in IDEA is in Edit Configurations...->Add->Gradle, task is jettyRun. For the first run all works fine, jetty starts, the webapp is availailable in a browser. But if I change something in the gradle.build file and rerun the task following error will occur:

A problem occurred configuring root project 'gr3'.
Could not open buildscript class cache for build file 'D:\Work\priv\gr3\build.gradle' (C:\Users\Sazankov_LY\.gradle\caches\1.7\scripts\build_546r8n6d85n2abfbi95h2qqmh4\ProjectScript\buildscript).

Timeout waiting to lock buildscript class cache for build file 'D:\Work\priv\gr3\build.gradle' (C:\Users\Sazankov_LY\.gradle\caches\1.7\scripts\build_546r8n6d85n2abfbi95h2qqmh4\ProjectScript\buildscript). It is currently in use by another Gradle instance.
     Owner PID: unknown
     Our PID: 11948
     Owner Operation: unknown
     Our operation: 
     Lock file: C:\Users\Sazankov_LY\.gradle\caches\1.7\scripts\build_546r8n6d85n2abfbi95h2qqmh4\ProjectScript\buildscript\cache.properties.lock

The only way to continue working is restarting IDE

Any ideas?

like image 210
kassie Avatar asked Jul 08 '14 14:07

kassie


2 Answers

After some research I've found out that problem is in correct terminating jetty. If you stop jetty by "Terminate" button on IDEA's toolbar, lock remains on the cache file. So you need to stop jetty via jettyStop task. Also you need to specify stopKey and stopPort for successful task executing.

like image 82
kassie Avatar answered Sep 20 '22 15:09

kassie


delete the lock file

sudo rm -f <lockfile>

kill the pid

kill -9 <pid>

Try again

gradle jettyRun -PbuildProfile=<profile>
like image 35
Rajan Avatar answered Sep 20 '22 15:09

Rajan