I’m trying to find what is effectively ‘gradle_home’ when using the wrapper. I want to know this so that I can setup my Intellij project files to automatically know how to run gradle tasks. I’m doing this:
CURRENT_GRADLE_VERSION = '1.3'
idea.project.ipr {
withXml { xml ->
def wrapperPath = "${System.properties['user.home']}/.gradle/wrapper/dists/gradle-$CURRENT_GRADLE_VERSION-bin"
def wrapperHome = new File(wrapperPath)
def uniqueId = wrapperHome.list()[0]
def uniqueHome = new File("$wrapperPath/$uniqueId/gradle-$CURRENT_GRADLE_VERSION")
def projectRoot = xml.asNode()
def existingNode = projectRoot.component.find {
it.@name == 'GradleSettings'
}
if (existingNode) {
projectRoot.remove(existingNode)
}
projectRoot.appendNode('component', [name: 'GradleSettings']).appendNode('option', [name: 'gradleHome', value: uniqueHome])
}
}
Is there an easier way to obtain that ‘uniqueHome’ value?
Thanks, -Kal