How to depend on a subproject's sourceset?


(Paul Jimenez) #1

I’m trying to get a multimodule project building, and it uses gwt. For this reason, I need to build one module but have the source of other modules on the classpath (the other modules have bits that the main gwt client module wants to use). How do I reference the sourceSet of another project? I was thinking I would end up doing something like

dependencies {

compile project(’:two’).sourceSet

}

but that (of course?) doesn’t work. I’m using the gradle-gwt-plugin from https://github.com/desource/gradle-gwt-plugin ; is there something else I should be using?


(Peter Niederwieser) #2

I don’t know how the ‘gwt’ plugin works, but if you want to add the Java source directories of project ‘:two’ to the ‘compile’ configuration, you can do it as follows:

dependencies {
  compile files(project(":two").sourceSets.main.java.srcDirs)
}

(David Harrigan) #3

Life saver! :slight_smile: