public void configureReloadAgent(JavaExecSpec exec) {
    if (springloadedJar == null) {
      return;
    }

    String agentJarFilePath = springloadedJar.getAbsolutePath();

    // Workaround http://issues.gradle.org/browse/GRADLE-2485
    Boolean isDebug = exec.getDebug();
    exec.jvmArgs(String.format("-javaagent:%s", agentJarFilePath), "-noverify");
    if (isDebug) {
      exec.setDebug(true);
    }
    exec.systemProperty("springloaded", "profile=grails");
  }