sourceSets on subprojects

Hello,

I have a parent script that builds different subprojects. I’m trying to set the scrDirs inside the parent script in this way

subprojects {
sourceSets {
   main {
		java.srcDirs = ["src/main/java"]
		resources.srcDirs = ["src/main/resources"]
	}
	test {
		java { srcDirs = ["src/test", "source-test"]}
		resources { srcDirs = ["src/test/resources", "resources-test"]}
	}
}
}

but the layout doesn’t change.

If I put a custom sourceSet in each subproject’s script, it works.

What am I doing wrong?

Thanks

Your configuration snippet looks good to me. Do you use the java or the java-base plugin? do you probably have multiple sourceSet configuration blocks in your build?

Hello Rene,

no I don’t have others sourceSets configurations. I have this portion of code

main {
			compileClasspath += configurations.provided // include dependencies in provided scope
			//			runtimeClasspath += configurations.provided // include dependencies in provided scope - it could be required to run tests
		}
		test {
			compileClasspath += configurations.provided // include dependencies in provided scope
			//			runtimeClasspath += configurations.provided // include dependencies in provided scope - it could be required to run tests
		}

but if I comment it nothing changes.

I’m using the java plugin, not the java-base

This issue can be closed, I found the error: I was applying other rules from a profile at the end of the script, so the ones I set were overwritten