Skip to content

Instantly share code, notes, and snippets.

Created May 27, 2013
Embed
What would you like to do?
import org.gradle.tooling.*
buildscript {
repositories {
mavenCentral()
maven {
url 'http://repo.gradle.org/gradle/libs-releases-local'
}
}
dependencies {
classpath 'org.gradle:gradle-tooling-api:1.6'
}
}
String jreHomeInJdk = 'C:\\Program Files\\Java\\jdk1.6.0_29\\jre'
task jdkTask {
doLast {
ProjectConnection connection = GradleConnector.newConnector().forProjectDirectory(projectDir).connect()
try {
def builder = connection.model(org.gradle.tooling.model.idea.IdeaProject)
builder.setJavaHome(new File(jreHomeInJdk))
println builder.get()
} finally {
connection.close()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment