Reputation: 59963
New to groovy, and I had one groovy project@commit 2f54b59 like below
├── build.gradle └── src └── main └── groovy ├── check.groovy └── helpers └── Person.groovy
And the check.groovy
is simple:
import helpers.*
println "hello"
person = new Person()
I try to use build.gradle
to manage the project with sourceSets
sourceSets { main { groovy { srcDirs('.') include '*.groovy' } } }
and meet error when build:
$ 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.
If u run the groovy
command directly, it works fine
$ cd src/main/groovy
$ groovy check.groovy
hello
How to setup the configuration to make it work?
Upvotes: 0
Views: 1552