Multi project build task dependencies

I have a flat multi-project with a build.gradle file at the root. Basic project dependencies are working fine, but I have two different source sets. The first one is the default Java sourceset and compiles fine. The second one is located at src/import/java in each project, and depends on the corresponding sourceset of each of its subprojects. How can Gradle resolve these dependencies ? This sourceset should only be compiled by a certain task, a default build should not process these (just like tests, except I cannot make it work).

Here is what I currently have (the projects share the same structure so all files are importing the same one) :

task buildImportModule(type: Jar, dependsOn: ['jar']) {
    description 'Permet de compiler le dossier src/import du projet'
    from(sourceSets.importSet.output) {
        include '**/*.class'
    archiveName = + "Import.jar"

artifacts {
    importCompile buildImportModule

if ("modules")) {
	String deps =
	def depsSplit = deps.split(',')
	depsSplit.each {dep ->
		buildImportModule.dependsOn tasks.getByPath(':' + dep + ':buildImportModule')