Search code examples
grailsgrails-plugingrails-2.0

What are inline plugins?


What is an inline plugin in Grails 2.X? How to make a plugin inline? I can find the documentation for Grails 3 but not for Grails 2.


Solution

  • Inline plugins in Grails 2.x are outlined in the documentation section for plugins.

    From the documentation:

    An application can load plugins from anywhere on the file system, even if they have not been installed. Specify the location of the (unpacked) plugin in the application's grails-app/conf/BuildConfig.groovy file

    Creating an inline plugin is done using the grails create-plugin command, just like a non-inline plugin.

    The only real difference between an inline-plugin and regular plugin is how it is referenced by your application. A normal plugin is pulled from a repository (such as maven) while an inline-plugin exists in source format local to the application that is using it. Take for example:

    /usr/foo/grails/MyApplication
    /usr/foo/grails/MyInlinePlugin
    /usr/foo/grails/MyOtherInlinePlugin
    

    The above application (MyApplication) can include the two plugins listed as inline plugins by using the following in the BuildConfig.groovy

    // BuildConfig.groovy
    grails.plugin.location.'my-inline-plugin' = "../MyInlinePlugin"
    grails.plugin.location.'my-other-inline-plugin' = "../MyOtherInlinePlugin"
    

    Overall inline plugins are useful when developing (or testing) a plugin as well as creating modular Grails applications.