How to copy test resources to build folder in the same directory structure

I am new user to gradle. I am trying to execute my junits using gradle script.
My sourcesets is like

test {
	resources {
		srcDir "connector/resources"

Now the files under this srcDir are being copied to ‘build/resources/test’ folder. But I wan the files need to be coped to ‘build/resources/test/connector/resources’ same folder structure as the source directory.

I am trying to use the task ‘processTestResources’. But i am not able to find the syntax how to use it.
Can you please help me how can i achieve it.

If that directory structure is important for your application, the srcDir should point to the parent directory of connector. E.g. in a typical Java project layout would be


and your srcDir would be


(by default).

See also 23.4 Project Layout (JavaPlugin)

I never tried manipulating the processTestResources task, so I don’t know how that would work. An alternative might be to copy manually with the Copy Task. But perhaps that’s a bit of overkill.

Thanks. It worked for me.