# Unable to set compileGroovy:groovyClasspath property

**URL:** <https://discuss.gradle.org/t/unable-to-set-compilegroovy-groovyclasspath-property/4640>\
**Category:** Old Forum Archive\
**Created:** [February 13, 2013, 2:20pm UTC](https://discuss.gradle.org/t/unable-to-set-compilegroovy-groovyclasspath-property/4640 "2013-02-13T14:20:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Binita\_Bharati](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/binita_bharati/32/895_2.png) [@Binita\_Bharati](https://discuss.gradle.org/u/Binita_Bharati)\
**Post date:** [February 13, 2013, 2:20pm UTC](https://discuss.gradle.org/t/unable-to-set-compilegroovy-groovyclasspath-property/4640/1 "2013-02-13T14:20:00Z")

</div>

Hi,

I am using gradle 1.4, and am trying to invoke a ‘compileGroovy’ task. My gradle.build file looks like this :

apply plugin: ‘groovy’ compileGroovy

{

source = fileTree(dir: ‘webapp/groovy’)

destinationDirectory = new File(‘webapp/WEB-INF/classes’)

}

On invoking , “gradle compileGroovy --debug”, I get the below Exception:

Caused by: org.gradle.api.InvalidUserDataException: ‘compileGroovy.groovyClasspath’ must not be empty. It is either configured automatically by the ‘groovy-base’ plugin, or can be set manually.

Now, the error is telling me to set the property , groovyClasspath. So, according to the docs ([http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.compile.GroovyCompile.html#org.gradle.api.tasks.compile.GroovyCompile:groovyClasspath](http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.compile.GroovyCompile.html#org.gradle.api.tasks.compile.GroovyCompile:groovyClasspath)), ‘groovyClasspath’ is a ‘org.gradle.api.file.FileCollection’, which can be instantiated by using ‘Project.files(java.lang.Object…)’. But, I am unable to use the ‘files’ method on ‘org.gradle.api.Project’.

Any pointers on what am I doing wrong ?

Thanks much

P.S : I am relatively a newbie in both Gradle and Groovy.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [February 13, 2013, 3:31pm UTC](https://discuss.gradle.org/t/unable-to-set-compilegroovy-groovyclasspath-property/4640/2 "2013-02-13T15:31:00Z")

</div>

Have you declared Groovy as a ‘compile’ dependency? The Groovy chapter in the [Gradle User Guide](http://gradle.org/docs/current/userguide/userguide_single.html) shows how it’s done.

PS: Please use HTML _code_ tags for all code.

---

<div class="post-metadata">

**Author:** ![Binita\_Bharati](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/binita_bharati/32/895_2.png) [@Binita\_Bharati](https://discuss.gradle.org/u/Binita_Bharati)\
**Post date:** [February 13, 2013, 5:56pm UTC](https://discuss.gradle.org/t/unable-to-set-compilegroovy-groovyclasspath-property/4640/3 "2013-02-13T17:56:00Z")

</div>

Thanks for the suggestion. The error has disappeared after adding the compile dependency. The working build file looks like this now :

```gradle
apply plugin: 'groovy'
repositories {
    mavenCentral()
}
dependencies {
    compile 'org.codehaus.groovy:groovy-all:2.0.6'
}
compileGroovy
        {
            source = fileTree(dir: 'webapp/groovy')
            destinationDir = new File('webapp/WEB-INF/classes')
        }

```
