New to groovy, and I had one groovy project@commit 2f54b59 like below
├── build.gradle
└── src
└── main
└── groovy
├── check.groovy
└── helpers
└── Person.groovy
check.groovy
import helpers.*
println "hello"
person = new Person()
build.gradle
sourceSets
sourceSets {
main {
groovy {
srcDirs('.')
include '*.groovy'
}
}
}
$ gradle build
:compileJava UP-TO-DATE
:compileGroovy
startup failed:
gradle-sample/src/main/check.groovy: 5: unable to resolve class Person
@ line 5, column 10.
person = new Person()
^
1 error
:compileGroovy FAILED
FAILURE: Build failed with an exception.
groovy
$ cd src/main/groovy
$ groovy check.groovy
hello
There's no need to configure any source sets - gradle will handle it itself.
See a little demo here.
apply plugin: 'groovy' repositories { mavenCentral() } dependencies { compile 'org.codehaus.groovy:groovy-all:2.3.11' }