Is it possible to exclude grails plugin from production environment?
Asked Answered
F

4

7

I would like to use certain plugin in development environment, but would like to exclude this plugin from production and from generated war. What is the easiest way to accomplish this?

Filaria answered 23/11, 2009 at 14:34 Comment(1)
Can you give me solution for grails 2.4.3?Vc
A
5

Yes, using plugin scopes. From http://grails.org/1.1+Release+Notes:

Plugins can now be scoped using either the environment or predefined build scopes:

def environments = ['dev', 'test']
def scopes = [excludes:'war']

The plugins will only load in those environments and will not be packaged into the WAR file. This allows "development-only" plugins to not be packaged for production use.

Ataraxia answered 23/11, 2009 at 16:31 Comment(1)
How to configure this?I am trying compile ":angular-annotate-asset-pipeline:2.0.2"{ def environments = ['dev', 'test'] } but getting errorVc
S
3

I don't believe that there is a way to achieve this without editing the plugin itself (as Jean pointed out)

If you have control over the plugin then that will work, but if you just wanted to configure this as you were 'using' it, then you will need to copy and run a patched version of the plugin with your modifications. You'd customizing it by utilizing a custom location for that plugin in your grails-app/conf/BuildConfig.groovy file.

Sinkhole answered 27/11, 2009 at 6:19 Comment(0)
L
3

If you want to exclude the plugin in certain environment, you need to do this:

runtime (':plugin:version') {
    if (Environment.current == Environment.PRODUCTION) {
        export = false
    }
}
Lam answered 17/5, 2013 at 13:35 Comment(0)
P
0

You can use the excludes property in your config.groovy:

production {
         grails.plugin.excludes='console,classDiagram'
}

But there seems to be some confusion as to if it will exclude it from both 'run-app' and 'war'. I will try to check today and verify

Parcae answered 26/9, 2013 at 12:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.