Adding groovy sub-project to Java projects so that it pulls in dependent jar files

(shahzad bhatti) #1

I have a set of Java projects such as: -client -server -common

I have configure settings.gradle as

include “common”, “client”, “server”

I then pull in common dependency by adding: dependencies {

compile project(’:common’) … } in client and server projects. This all work perfectly.

Now, I am adding a groovy project (for mostly testing) and I would like it to depend on common and client projects so that it pulls in necessary jar files. I modified the settings.gradle and added groovy (qa-automation) project

include “common”, “client”, “server”, “qa-automation”

I then added

dependencies {

compile project(’:common’)

compile project(’:client’) to build.gradle for my groovy project. However, it’s not pulling in dependencies and I am getting class not found errors.

Can someone help me for adding dependency for Java sub-project so that my groovy project (which is mostly tests) can import Java classes.


(Eric Berry) #2

This should work fine. Which version of Gradle are you using? Also, not sure if that is the exact dependencies closure you’re using, but you’re missing the groovy definition: Eg.

dependencies {
   groovy localGroovy()
   compile project(":common"),