How can I share the same sourceSet across a multi project?

I am new to gradle, please answer with mercy. My multi-project structure.

si – projectC (which contains all my classes) – projectA (which contains UI tests spec) – projectB (which contains Api level tests)

I need the sourceSet (main srcDir) of Project A & B to point to project C. so I can use the code without compilation error like,

1: unable to resolve class com.practice.gradle.BaseGebSpec

@ line 1, column 1.

import com.practice.gradle.BaseGebSpec


1 error

Where com.practice.gradle.BaseGebSpec is projectC

I have tried the following: projectA.gradle

dependencies {

compile project(’:projectC’) }


dependencies {

compile project(’:projectC’) }

Thanks alot for your kind Reponse.