I'm trying to run a Groovy class from within my build.gradle file. I'm following the direction in the use guide however I get an error.
The build file is:
apply plugin: 'java'
apply plugin: 'groovy'
main {
java {
srcDirs = ["$projectDir/src/java"]
}
groovy {
srcDirs = ["$projectDir/src/groovy"]
}
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.2.0', files(....)
}
task fooTask << {
groovyClass groovyClass = new groovyClass()
groovyClass.foo()
}
The groovy class is very simple:
public class groovyClass {
public void foo() {
println 'foo'
}
}
However when I try to run gradlew compile fooTask I get the following error:
unable to resolve class groovyClass
Any idea why?
Thanks