I have a trivial Gradle project:
apply plugin: 'groovy'
apply plugin: 'application'
mainClassName = 'HelloWorld'
With one Groovy source file in src/main/groovy
:
public class HelloWorld {
public static void main(String[] args) {
print "hello world"
}
}
I type gradle run
and get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Cannot infer Groovy class path because no Groovy Jar was found on class path: [/Users/jzwolak/files/experimenting/gradle/groovy-project/build/classes/java/main]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 0s
1 actionable task: 1 executed
How do I configure the Groovy classpath for Gradle?
I have Groovy at /usr/local/opt/groovy/libexec/
You need to declare a groovy dependency, as in the documentation https://docs.gradle.org/current/userguide/groovy_plugin.html#sec:groovy_dependency_management
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.14'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With