Java 向IntelliJ编译器类路径添加渐变深度

Java 向IntelliJ编译器类路径添加渐变深度,java,intellij-idea,gradle,Java,Intellij Idea,Gradle,给定一个具有如下依赖关系的build.gradle: dependencies { compile fileTree(dir: 'myLegacyLibsNotYetConverted/lib', include: '*.jar') compile fileTree(dir: 'myOtherLegacyLibsNotYetConverted/lib', include: '*.jar') compile 'org.springframework:spring-tx:3.

给定一个具有如下依赖关系的
build.gradle

dependencies {
    compile fileTree(dir: 'myLegacyLibsNotYetConverted/lib', include: '*.jar')
    compile fileTree(dir: 'myOtherLegacyLibsNotYetConverted/lib', include: '*.jar')
    compile 'org.springframework:spring-tx:3.1.2.RELEASE'
    compile 'org.springframework:spring-jms:3.1.2.RELEASE'
    compile 'org.springframework:spring-jdbc:3.1.2.RELEASE'
    (...)

    testCompile "junit:junit:4.11"
    testCompile fileTree(dir: "legacyBuild/test-lib", include: "*.jar")
    (...)

    providedCompile "javax.servlet:servlet-api:2.5"
    providedCompile "javax.servlet.jsp:jsp-api:2.2"
}
将它们添加到IntelliJ的IDE类路径以使所有交互式编译器和测试具有所需的所有类依赖关系的最简单/推荐的方法是什么?是否可以在每次更改时同步它


一个可以在Eclipse中工作的灵活的解决方案,只需稍作修改,也会非常受欢迎。

最简单的解决方案是使用IDE插件。IntelliJ 13(EAP)为Gradle提供了非常好的开箱即用支持。(我不建议使用Intellij12JetGradle插件,因为它太有限了。)对于Eclipse,有一个。两个插件都将在按下按钮时重新同步依赖项


另一种方法是使用
eclipse
/
idea
Gradle插件,并在必要时(重新)生成IDE项目文件。此方法在.

中有记录,假设您已经安装了Gradle插件(首选项>插件>安装JetBrains插件>Gradle),使用IntelliJ 12,只需单击Refresh Gradle项目,就可以将所有依赖项放在类路径中。

首选项在哪里?它在文件->设置中。或者按ctrl+alt+s