gradle-plugins
jarTest Plugin
Create a jar artifact from the test build output of a project. It can be added as dependency via the 'testArchives' configuration (which will also provide the transitive dependencies).
See jarTest Plugin for usage info.
Gradle has a similar built-in feature via the java-test-fixtures plugin.
jarTest Demo
This a simple demo project for the jarTest plugin.