简体   繁体   中英

How to use different IDE specific plugins in build.gradle

I have a Gradle project which now runs with the eclipse plugin

apply plugin: 'eclipse'

But, I want gradle to support any IDE(s) either,

  1. Switching the plugin using any gradle command or
  2. Without using the "apply plugin" goal

I want to support both Eclipse, IDEA IDE(s), this way users of IntelliJ won't need to swap it.

You can have both the eclipse and the intellij plugins applied at the same time. They only add some additional tasks for creating the respective project configuration files, and they do not conflict with each other.

For IntelliJ, you just import the Gradle project directly from the IDE and you should not create project files using the command line interface. The IDE will also implicitly apply the intellij plugin if it is missing, so you don't even need it in the build file unless you need to customize the project in a way that is different from the defaults and from what it can infer from the build file.

I haven't used Eclipse in a long time and I don't know if it requires the presence of the eclipse plugin. If it does, just keep it. But you don't have to do anything else to support IntelliJ (assuming the defaults are OK).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM