Maven-deploy plugin ignores dependsOn set in task

Hi, I am trying to add a dependency on test to my maven upload tasks from within a custom task but it seems to get ignored. Being new to grade I am not sure if this is expected behaviour?

I tried to set the dependsOn in the plugin definition but at that point in the process it seems the tasks are not setup
in both cases I am using
project.tasks.withType(PublishToMavenRepository)
but it seems during the plugin initialisation there are as yet no tasks of a type PublishToMavenRepository. If I try to do the same in my custom Task the PublishToMavenRepository tasks are found and I can execute dependsOn() but it has absolutely no impact.
I can of course have a line in the build.gradle
tasks.withType(PublishToMavenRepository) { it.dependsOn test }
but I am trying to abstract our developers from having to set some of the basic things we wish to enforce so it seemed reasonable to do this in a plugin instead.

I think its probably worth asking why the default behaviour of the PublishToMavenRepository tasks appears to be to deploy to the repo before the test cycle as well? Seems like a strange default to me.

thanks
Paul