In our Groovy scripts we can use the
With this annotation we define dependencies for our script and they will be automatically downloaded and added to the class path when we run our script.
When we use IntelliJ IDEA we can use a nice intention that is part of the IntelliJ IDEA Groovy support to download the dependencies from our IDE editor.
IDEA downloads the dependencies and add it to the project module dependencies.
This is useful, because this will also adds code completion for the classes in the dependency to our editor.
Let’s see this with a little example. We have the following Groovy script in our Groovy project in IntelliJ IDEA: