给定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中进行微小更改的灵活解决方案也非常受欢迎。
答案 0 :(得分:5)
假设您已安装Gradle插件(首选项>插件>安装JetBrains插件> Gradle),使用IntelliJ 12,只需单击Refresh Gradle Project即可将所有依赖项放在类路径中。
答案 1 :(得分:2)
最简单的解决方案是使用IDE插件。 IntelliJ 13(EAP)为Gradle提供了出色的开箱即用支持。 (我不建议使用IntelliJ 12 JetGradle插件,因为它太有限了。)对于Eclipse,有Eclipse Gradle Tooling。只需按一下按钮,两个插件都将重新同步依赖关系。
另一种方法是使用eclipse
/ idea
Gradle插件,并在必要时(重新)生成IDE项目文件。这种方法记录在Gradle User Guide。