如何在 IDEA 中定义 Gradle 的家? [英] How to define Gradle's home in IDEA?

查看:29
本文介绍了如何在 IDEA 中定义 Gradle 的家?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Gradle 项目导入 IntelliJ,当我到达 Gradle Home 文本框时,它不会自动填充,也不会输入 Gradle Home 导致一个有效的位置 - 我有 GRADLE_USER_HOME 环境变量设置(我认为是!)正确的路径,我已经能够成功地将这个相同的项目导入到 Eclipse 中.有什么建议吗?

I am trying to import a Gradle project into IntelliJ, and when I get to the Gradle Home textbox, it is not automatically populated, nor will typing in the path of Gradle Home result in a valid location - I have the GRADLE_USER_HOME environment variable set (to what I think is!) the correct path, and I have been able to successfully import this same project into Eclipse. Any suggestions?

推荐答案

你可以写一个 简单的 gradle 脚本 打印你的 GRADLE_HOME 目录.

You can write a simple gradle script to print your GRADLE_HOME directory.

task getHomeDir {
    doLast {
        println gradle.gradleHomeDir
    }
}

并将其命名为build.gradle.

然后运行它:

gradle getHomeDir

如果你是用homebrew安装的,使用brew info gradle找到基本路径(即/usr/local/Cellar/gradle/1.10/),然后追加libexec.

If you installed with homebrew, use brew info gradle to find the base path (i.e. /usr/local/Cellar/gradle/1.10/), and just append libexec.

在 Kotlin 中使用 build.gradle.kts 时的相同任务:

The same task in Kotlin in case you use build.gradle.kts:

tasks.register("getHomeDir") {
    println("Gradle home dir: ${gradle.gradleHomeDir}")
}

这篇关于如何在 IDEA 中定义 Gradle 的家?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆