Question

I am trying to build a Grails plugin that will act as a "master plugin" for a suite of other Grails apps.

I am wondering if it is possible to somehow chain plugins together transitively? Pretend that Plugin A depends on Plugin B, and that Grails App GA1 uses (installs) Plugin A. When the developer does this install of Plugin A (the "master") to Grails App GA1, they end up installing Plugin A as well as Plugin B, transitively.

Is this possible? If so, how? If not, why, and is there a way to hack this or is there a better way to transitively install plugins in general?

Was it helpful?

Solution

Pretend that Plugin A depends on Plugin B

This means that your Plugin A BuildConfig will have:

plugins {
  compile ':pluginB:...'
}

When you install Plugin A in your application, Grails will automatically download and install plugin B too.

This is also true for the dependencies block. So yes, you can have a plugin that depends on a list of plugins and the application will install all of them. This is the default behavior of using plugins in Grails.

On the contrary, if you want not to get Plugin C (if there is any which is used by Plugin A), when Plugin A is used in the Grails App then you can selectively block the transitivity of pulling Plugin C into the app. Inside BuildConfig of Plugin A, you can specify:

plugins {
    compile(':pluginC:...') {
        //makes sure Plugin C is not available 
        //when Plugin A is used in the app
        export = false 
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top