MuzzlePlugin groovy checks that no threads are spawned because this holds the ClassLoader live.
This was breaking with the caching change because the cache no longer uses the Cleaner service.
This caused a problem because the Thread behind the cleaner is created lazily when the first task is created, but without the cache the creation was delayed.
To solve this, I addressed the original cause of the leak. The newly created Thread automatically inherits the contextClassLoader of its parent, but that's unnecessary for a cleaner thread.
So I changed the ThreadFactory for cleaner to explicitly null out the contextClassLoader.
We should probably null out contextClassLoader in other thread factories and also reduce our use of contextClassLoaders in general, but that will left to another PR.
The muzzle plugin creates a config for each of the dependencies under test with name '...-<group_id>-<artifact_id>-<version>'.
The problem is that if we want to test multiple times the same configuration under different conditions, e.g.
with different extra dependencies, the plugin would throw an error as it would try to create several times the same config.
This commit let directives to define an optional name that defaults to a null. If a name is provided then a slug of it
is used to generate the gradle configuration name.