Closed
Description
Depending on what plugins and in which order you add to gradles plugins { ... }
block in the build file, forbiddenapis does not load. Using the currently documented way it works, but since the plugin was released to the Gradle Plugin Portal (see #107) this does not work:
build.gradle
plugins {
id 'java'
id 'de.thetaphi.forbiddenapis' version '2.5'
}
repositories {
jcenter()
}
group = 'test'
version = '1.0.0'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
* Where:
Build file '/Users/dev/tmp/forbiddenapis/build.gradle' line: 3
* What went wrong:
An exception occurred applying plugin request [id: 'de.thetaphi.forbiddenapis', version: '2.5']
> Failed to apply plugin [id 'de.thetaphi.forbiddenapis']
> Cannot execute Groovy script for apply(Project).
> Forbidden-apis only works in projects using the java plugin.
The problem is that plugin-init.groovy check, if the JavaBasePlugin
was loaded before the forbidden plugin was applied. With the new plugin mechanism it's not guaranteed.
To fix this, we change the init script to just apply the JavaBasePlugin on startup. Newer gradle plugins do this in the same way.
Unfortunately we have to release a new version. Thanks @sdavids for reporting.