Search code examples
grailsember.jsintellij-ideagradle

IntelliJ IDEA: Gradle indexing files - infinite loop


I'm developing a web application, using Grails 2.2.3 with Ember.js (rc3). I'm using IntelliJ IDEA 12.1 Utlimate as IDE and also the IntelliJ TeamCity CI Server - everything's on Windows 7 Professional SP1. Now I wanted to use Gradle 1.7 to better organize my build tasks (combining Grails, Grunt, testing and so on...) and I expected paradise but all I got was hell...

As soon as I started to use the gradle.build file and started JetGradle in IntelliJ IDEA it started to scan and index files over and over (actually it is still running now - 14 hours and counting), the IDE is blocked and I can't do anything... it's really frustrating.

If it's of any interest, here's my gradle.build:

import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.tasks.Exec
import org.grails.gradle.plugin.GrailsTask

buildscript {
  repositories {
    maven { url "http://my.company.archiva:8080/repository/internal" }
    maven { url "http://repo.grails.org/grails/repo" }
  }

  dependencies {
    classpath "org.grails:grails-gradle-plugin:2.0.0-SNAPSHOT",
        "org.grails:grails-bootstrap:2.2.3"
  }
}

apply plugin: "grails"
apply plugin: "base"

repositories {
  maven { url "http://my.company.archiva:8080/repository/internal" }
  maven { url "http://repo.grails.org/grails/repo" }
}

grails {
  grailsVersion "2.2.3"
}

configurations {
  all {
    exclude module: "commons-logging"
    exclude module: "xml-apis"
    exclude module: "grails-plugin-log4j"
    exclude module: "slf4j-log4j12"
  }
  test {
    exclude module: "groovy-all"
  }
  compile {
    exclude module: "hibernate"
  }
  compileOnly
}

dependencies {
  compile("com.my.company:grails-custom-plugin1:0.1.7@zip")
  compile("com.my.company:grails-cusotm-plugin:0.2@zip")
  compile("com.my.company:backendapi:1.1")

  compile("org.mozilla:rhino:1.7R4")

  compile("io.netty:netty:3.3.1.Final")
  compile("com.google.protobuf:protobuf-java:2.4.1")

  compile("org.grails.plugins:cache:1.0.1")

  compileOnly "org.grails:grails-plugin-tomcat:$grails.grailsVersion" // No tomcat-*.jar in the war

  bootstrap "org.codehaus.groovy:groovy-all:2.0.5"
}


/*
GRADLE Wrapper
*/

task wrapper(type: Wrapper) {
  gradleVersion = '1.7'
}


/*
GRUNT Section
*/

task npm(type: Exec) {
  group = "Build"
  description = "Installs all Node.js dependencies defined in package.json"
  workingDir "web-app"
  commandLine = ["npm.cmd", "install"]
  inputs.file "package.json"
  outputs.dir "node_modules"
}

task production(type: GruntTask) {
  gruntArgs = "prod"
}

class GruntTask extends Exec {
  private String gruntExecutable = Os.isFamily(Os.FAMILY_WINDOWS) ? "grunt.cmd" : "grunt"
  private String switches = "--no-color"
  private String workDir = "web-app"

  String gruntArgs = ""

  public GruntTask() {
    super()
    this.setExecutable(gruntExecutable)
    this.workingDir(workDir)
  }

  public void setGruntArgs(String gruntArgs) {
    this.args = "$switches $gruntArgs".trim().split(" ") as List
  }
}

/*
WAR creation
*/

task war(type: GrailsTask) {
  command "war"
  env "prod"
}

Is anybody out there who is able to help me? I searched the internet up and down but it seems that either nobody is using the combination of Grails, Ember.js, Gradle, IntelliJ IDEA or everything is dead simple and I'm just to stupid to use the tools...


Solution

  • I don't recommend to use the Gradle integration in IDEA 12 as it's too limited. (IDEA 13 will be better.) Instead you can use Gradle's "idea" plugin to generate IDEA files. Not sure how well all of this works together with Grails. Grails' own build tool is deeply integrated with the rest of Grails, and from what I've heard, using anything else means to make compromises. (I don't have first-hand experience though.) There have been plans for Grails to switch over its built-in build tool to Gradle one day.

    PS: I'd search the IDEA issue tracker and file an issue if there is none.