In my previous post, I successfully managed to put all the output of Maven (and Eclipse) into RAM to reduce the disk write. In today post, I will do the same thing but with Gradle. Here is my build.gradle
apply plugin: "java"
apply plugin: "war"
apply plugin: "eclipse"
sourceCompatibility = 1.6
targetCompatibility = 1.6
group = "me.tinhtruong"
version = "1.0"
repositories {
mavenCentral()
}
dependencies {
compile "com.icegreen:greenmail:1.3.1b"
compile "jstl:jstl:1.2"
providedCompile "javax.servlet:servlet-api:2.5"
}
// Change the buildDir of the current project to /tmp/ (which is mounted on RAM using tmpfs)
buildDir = new File("/tmp/gradle/" + project.name);
// First, create a linked resource pointing to our Gradle buildDir, then hook into the .classpath file generation of Gradle to change the output of Eclipse to that linked resource.
eclipse {
project {
linkedResource name: 'build', type:'2', location: buildDir.absolutePath
}
classpath {
file {
whenMerged { classpath ->
classpath.entries.each { entry ->
if (entry.kind == 'output') {
entry.path = 'build/eclipse-output';
}
}
}
}
}
}