On 04/03/2011, at 3:54 PM, Brett Cave wrote:
> Hi, we have just added in some groovy files for compilation to a multi module
> project, source code added to src/main/groovy
>
> I get a compilation error:
> /path/to/src/main/groovy/com/package/web/Something.groovy: 6: unable to
> resolve class com.package.model.SomeModel
> import com.package.model.SomeModel
>
> SomeModel class is from one of the other modules (its a java class). I added
> the following to build.gradle for this project
>
> apply plugin: 'groovy'
>
> dependencies {
> groovy 'org.codehaus.groovy:groovy:1.8.0-beta-2',
> project(':model-project')
> }
>
> the model-project is also listed as a dependency under the "compile"
> configuration.
>
> I have also tried using this syntax in the build file, from the groovy plugin:
> dependencies {
> groovy module('org.codehaus.groovy:groovy:1.8.0-beta-2') {
> dependency(project(':model-project'))
> }
>
> I get a slightly different exception: ClassNotFound for a transitive
> dependency
>
> How should I correctly configure the groovy compilation classpath
You declare the dependencies for Groovy source the same way as for Java source:
dependencies {
compile project(':model-project')
}
You use the groovy configuration to declare which Groovy version/implementation
to use to compile the source:
dependencies {
groovy 'org.codehaus.groovy:groovy:1.8.0-beta-2'
}
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
Co-Founder and VP of Engineering, Gradleware Inc. - Gradle Training, Support,
Consulting
http://www.gradleware.com