Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle- Eclipse and IDEA plugin in same script?

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.

like image 254
tmn Avatar asked Apr 23 '15 19:04

tmn


People also ask

How do I sync Gradle project in IntelliJ?

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.

Why Gradle is not showing in IntelliJ?

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.


2 Answers

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.

like image 90
JB Nizet Avatar answered Sep 20 '22 09:09

JB Nizet


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

like image 27
RaGe Avatar answered Sep 20 '22 09:09

RaGe