Using Inline Plugins in Grails 3

In Grails 2.x, it was possible to specify inline plugins in BuildConfig.groovy but in Grails 3 this has been changed. As Grails 3.x uses Gradle as it’s build tool, we need to define inline plugins as a sub-module in our main app. 

Assuming that you have already created an application and a plugin here is how you can use your plugin inline with your application instead of publishing it locally or to your plugin repository each time you make a change.

  1.  Open build.gradle file of your application and add this line in dependencies
     compile project(':plugin_name')
  2.  Now open settings.gradle  file of your application and append these lines to this file-
     include 'plugin_name'
         project(':plugin_name').projectDir = new File('/path/to/plugin')

Make sure that you have given the absolute path of your plugin in above line.

Now compile the application and you are good to go.

Note: In case you find that changes in your plugin files are not being reflected in a running Grails app, then stop and re-run the application. This might be because hot reloading does not work in all cases like when there is a change in Domain class.

About CauseCode: We are a technology company specializing in Healthtech related Web and Mobile application development. We collaborate with passionate companies looking to change health and wellness tech for good. If you are a startup, enterprise or generally interested in digital health, we would love to hear from you! Let's connect at bootstrap@causecode.com

Leave a Reply

Your email address will not be published. Required fields are marked *

STAY UPDATED!

Do you want to get articles like these in your inbox?

Email *

Interested groups *
Healthtech
Business
Technical articles

Archives