Intellij重新导入Gradle项目 [英] Intellij Re-import Gradle Project

查看:1031
本文介绍了Intellij重新导入Gradle项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在Gradle项目中添加了一个新的测试源目录,并希望IntelliJ识别它.我可以关闭项目并重新打开build.gradle文件,然后选择删除现有项目并导入";有没有一种方法可以在不删除现有项目的情况下更新模块源代码?

I just added a new test source directory to my Gradle project and want IntelliJ to recognize it. I can close the project and reopen the build.gradle file and chose "Delete Existing Project and Import"; is there a way to update the module sources without deleting the existing project?

idea {
    module {
        // just added these two lines        
        testSourceDirs += file('src/integration-test/java')
        testSourceDirs += file('src/integration-test/resources')
    }
}

我不想只是手动添加源代码,而是希望IntelliJ从"build.gradle"文件中重新导入Gradle项目结构.

I don't want to just manually add the sources, instead I want IntelliJ to re-import the Gradle project structure from the 'build.gradle' file.

详细信息: Gradle v1.7,IntelliJ v12

Details: Gradle v1.7, IntelliJ v12

推荐答案

IntelliJ 13支持刷新" Gradle项目.刷新项目时,将拾取所有依赖项更改以及对项目结构的任何更改.

IntelliJ 13 supports "refreshing" the Gradle project. When the project is refreshed any dependency changes are picked up as well as any changes to the project structure.

为此,请转到视图"->工具窗口",然后打开"Gradle工具窗口",您会在上方的栏中找到刷新"按钮.

In order to do so go to View -> Tool Windows and open the Gradle Tool Window you find the refresh button in the upper bar.

这篇关于Intellij重新导入Gradle项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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