How to apply a community plugin to a Gradle project which is created by ProjectBuilder?
In my unit test I have this code which fails with “org.gradle.api.plugins.UnknownPluginException: Plugin with id ‘net.researchgate.release’ not found.”:
private Project createProject()
{
Project project = ProjectBuilder.builder().withName('some-name').withProjectDir(Paths.get(System.getProperty('user.dir')).resolve('build').resolve('test').toFile()).build()
project.buildscript
{
repositories
{
jcenter()
}
dependencies
{
classpath 'net.researchgate:gradle-release:2.1.0'
}
}
project.pluginManager.apply 'net.researchgate.release'
return project
}
Currently I use a workaraound (I’ve downloaded the gradle-release jar and added it to the testCompile dependencies). But I hope there is a better way.