@Grab
is meant to be used for standalone scripts that aren't precompiled, and you wouldn't normally use it together with compiled code. If you do, you may have to add Ivy to groovyClasspath
. Something like:
repositories {
mavenCentral()
}
configurations {
ivy
}
dependencies {
ivy "org.apache.ivy:ivy:2.3.0"
compile "org.codehaus.groovy:groovy-all:2.1.5"
}
tasks.withType(GroovyCompile) {
groovyClasspath += configurations.ivy
}
That said, a better approach is to manage dependencies with Gradle.