Appendix E. Existing IDE Support and how to cope without it

E.1. IntelliJ

Gradle has been mainly developed with Idea IntelliJ and its very good Groovy plugin. Gradle's build script [27] has also been developed with the support of this IDE. IntelliJ allows you to define any filepattern to be interpreted as a Groovy script. In the case of Gradle you can define such a pattern for build.gradle and settings.gradle. This will already help very much. What is missing is the classpath to the Gradle binaries to offer content assistance for the Gradle classes. You might add the Gradle jar (which you can find in your distribution) to your project's classpath. It does not really belong there, but if you do this you have a fantastic IDE support for developing Gradle scripts. Of course if you use additional libraries for your build scripts they would further pollute your project classpath.

We hope that in the future *.gradle files get special treatment by IntelliJ and you will be able to define a specific classpath for them.

E.2. Eclipse

There is a Groovy plugin for eclipse. We don't know in what state it is and how it would support Gradle. In the next edition of this user guide we can hopefully write more about this.

E.3. Using Gradle without IDE support

What we can do for you is to spare you typing things like throw new org.gradle.api.tasks.StopExecutionException() and just type throw new StopExecutionException() instead. We do this by automatically adding a set of import statements to the Gradle scripts before Gradle executes them. Listed below are the imports added to each script.

Figure E.1. gradle-imports

import org.gradle.*
import org.gradle.util.*
import org.gradle.api.*
import org.gradle.api.artifacts.*
import org.gradle.api.artifacts.result.*
import org.gradle.api.artifacts.dsl.*
import org.gradle.api.artifacts.maven.*
import org.gradle.api.artifacts.specs.*
import org.gradle.api.publish.*
import org.gradle.api.publish.ivy.*
import org.gradle.api.publish.ivy.tasks.*
import org.gradle.api.execution.*
import org.gradle.api.file.*
import org.gradle.api.resources.*
import org.gradle.api.initialization.*
import org.gradle.api.invocation.*
import org.gradle.api.logging.*
import org.gradle.api.plugins.*
import org.gradle.plugins.ide.eclipse.*
import org.gradle.plugins.ide.idea.*
import org.gradle.plugins.jetty.*
import org.gradle.api.plugins.quality.*
import org.gradle.api.plugins.announce.*
import org.gradle.api.plugins.buildcomparison.gradle.*
import org.gradle.api.specs.*
import org.gradle.api.tasks.*
import org.gradle.api.tasks.bundling.*
import org.gradle.api.tasks.diagnostics.*
import org.gradle.api.tasks.compile.*
import org.gradle.api.tasks.javadoc.*
import org.gradle.api.tasks.testing.*
import org.gradle.api.tasks.util.*
import org.gradle.api.tasks.wrapper.*
import org.gradle.api.tasks.scala.*
import org.gradle.process.*

[27] Gradle is built with Gradle