I'm trying to figure out how Gradle applies IDE plugins. If I wanted a build.gradle
script that accommodated both Eclipse and IDEA, can I declare both plugins in the script? Will it try to create the metadata for both? Or is the IDE Gradle implementation start enough to choose the correct one?
apply plugin: 'eclipse'
apply plugin: 'idea'
I just want to make sure that when I put any project source files in a GIT repository with the build.gradle
script, the import and build experience will be fine for those IDEs.
If you have some custom plugins that require you to import your project from the IntelliJ IDEA model, press Ctrl+Shift+A and search for the Project from Existing Sources action. In the dialog that opens, select a directory containing a Gradle project and click OK. IntelliJ IDEA opens and syncs the project in the IDE.
Go to Settings/Preferences > Plugins and enable or install the JetBrains Gradle plugin. NOTE 2: If the gradle build can not be completed successfully, IntelliJ IDEA may not be able to sync to it properly. In such cases, you will likely need to get the gradle build working first.
Applying the eclipse plugin simply adds eclipse tasks to the build allowing to generate an eclipse project from the gradle project.
Applying the idea plugin simply adds idea tasks to the build allowing to generate an IDEA project from the gradle project.
I don't see any reason why you couldn't do both.
Just adding the plugins to your build.gradle
file doesn't do anything until you run one or more of the tasks that these plugins introduce. It wont create any metadata for either IDE until you run the specific tasks.
For a list of tasks that each plugin adds, see these links:
ref:
http://gradle.org/docs/current/userguide/idea_plugin.html
http://gradle.org/docs/current/userguide/eclipse_plugin.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With