[英]Adding Gradle depdencies to IntelliJ compiler classpath
給定一個具有以下依賴關系的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中進行微小更改的靈活解決方案也將非常受歡迎。
假設你已經安裝了Gradle插件(首選項>插件>安裝JetBrains插件> Gradle),使用IntelliJ 12,只需單擊Refresh Gradle Project就可以將所有依賴項放在類路徑中。
最簡單的解決方案是使用IDE插件。 IntelliJ 13(EAP)為Gradle提供了出色的開箱即用支持。 (我不建議使用IntelliJ 12 JetGradle插件,因為它太有限了。)對於Eclipse,有Eclipse Gradle Tooling 。 兩個插件只需按一下按鈕即可重新同步依賴項。
另一種方法是使用eclipse
/ idea
Gradle插件並在必要時(重新)生成IDE項目文件。 Gradle用戶指南中介紹了此方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.