Though IntelliJ does not support Gradle buildfiles, and vice-versa Gradle does not generate an IntelliJ project definition (yet), we can use the Eclipse integration that both provide. You can set it up in the following way. In your build.gradle file, add the eclipse plugin:
defaultTasks 'build'
usePlugin 'java'
usePlugin 'eclipse'
repositories {
mavenCentral()
}
dependencies {
testCompile "org.junit:junit:4.7"
}
If you now type "gradle eclipse", gradle will generate an Eclipse ".project" and ".classpath" file for you. Each time you run "gradle eclipse", these two will get refreshed.
Now go to IntelliJ IDEA. Instead of importing the project as a "new project", we choose "Open Project"
Now browse to your project, click the ".project" file and click "open"
Presto you're done. Now everytime gradle re-generates the classpath file, your IntelliJ project is kept in sync.
No comments:
Post a Comment