I have added a plugin id "ua.eshepelyuk.ManifestClasspath" version "1.0.0" to plugins {} in my build.gradle file. I **would like to only run the plugin when using a windows computer. So what I tried is to add an if statement around the plugin. I have included Gradle plugin with my if statement below:
Build.graddle file:
plugins {
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"
}
}
When using the if statement above I get the error: 'only id(String) method calls allowed in plugins {} script block'. How can I fix this?
Give below a try...
plugins {
id "ua.eshepelyuk.ManifestClasspath" version "1.0.0" apply false
}
if(System.getProperty("os.name").toLowerCase().contains("windows")) {
apply plugin: “ua.eshepelyuk.ManifestClasspath”
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With