Can't change output dir for resources

plugins {
	id 'java'
}

sourceSets {
    def resourcesSubDir = new File("${sourceSets.main.output.resourcesDir}/modules/${name}")
	custom {
		java.destinationDirectory.fileValue resourcesSubDir
		resources.destinationDirectory.fileValue resourcesSubDir
	}
	def allTasks = ['compileCustomJava', 'processCustomResources']
	tasks.findAll { it.name in allTasks }*.configure {
		// setDestinationDir has no effect as well
		destinationDir = resourcesSubDir
		println destinationDir
	}
}

output is

/tmp/t/build/resources/main/modules/t
/tmp/t/build/resources/custom

neither changing sourceSets.custom.resources.destinationDirectory, nor setting destinationDir on the task has any effect. How can I change the output dir for these resources?