Exclude plugin for specific environment

In your buildConfig.groovy you can define a plugin to not export:

plugins {
  compile(':theplugin:theversion') {
    export = false
  }
}

let me throw an answer in the ring. Similar to what @hitty5 is proposing, but with some changes (and a bug fix).

For us, it is important to exclude some page speed plugins, when working on the DEVELOPMENT environment, as we want to see the resources in full. On the other hand we don't want to copy the plugins that should be on every machine between blocks (like you would have to in @hitty5 's solution).

plugins {
    runtime ":hibernate:$grailsVersion"
    // ... some more plugins that I want in every environment

    if (Environment.getCurrent() in [Environment.PRODUCTION, Environment.TEST]) {
        // plugins, that I only want on the test and production servers
        println("BuildConfig: including page speed optimization plugins.")
        runtime ":zipped-resources:1.0"
        compile ":cache-headers:1.1.5"
        runtime ":cached-resources:1.0"
        runtime ":yui-minify-resources:0.1.5"
    }

    // ... and more plugins, if you like
    build ":tomcat:$grailsVersion"

}

Hope this helps.

All the best, fluxon


first i recommend to use the build config file (BuildConfig.groovy) to resolve your plugin dependencies. inside this file you can define env specific blocks like:

if (environment == Environment.PRODUCTION){
    plugins {            
            compile ":<plugin>:<version>"
        }
    }
else {
        plugins {            
            compile ":<plugin>:<version>"
        }
}