My plugin checks if Java plugin is applied to generate verbose error message (instead of “missing sourceSets property”). I use “!project.plugins.hasPlugin(“java”)”. Unfortunately it doesn’t work when the new plugin mechanism is used.
plugins {
id "java"
id "info.solidsoft.pitest" version "1.1.0"
}
Is that expected behavior? If yes, how can I check if in the project the java plugin has be applied?
When using the new plugin application mechanism core plugins are internally applied using their fully qualified names and they are located in the ‘org.gradle’ namespace, so for java plugin the id passed to ‘hasPlugin()’ should be ‘org.gradle.java’. This will be improved in 2.3 and a core plugin will be reported as applied if you pass either a qualified or unqualified id to ‘hasPlugin()’.
We have branched for release already so nightlies point at 2.4. It’s a bit slow over Christmas but we should be releasing some RCs for 2.3 soonish. You can always use nightlies (which are basically built off master) until then.