Adding in-place plugin to grails 3 project
Asked Answered
B

2

6

In grails 2.x, we were allowed to add an in place plugin by adding following in BuildConfig.groovy

grails.plugin.location."my-plugin" = "../my-plugin"

My question is, can we add our local plugins similarly in-place in grails3.0 as well or there is some other way to do this in grails.

Actual purpose is to test the plugin whether it's working properly or not before pushing it to bintray.

Breedlove answered 6/2, 2016 at 12:38 Comment(1)
Did you try it packaging like maven local repository?Jayjaycee
N
6

Yes, there is. Grails 3 is based on Gradle so multi-project gradle builds solve your issue.

Basically you add dependency as: compile project(':../my-custom-plugin') and has to modify settings.gradle to include plugin: include '../my-custom-plugin'

Check Grails documentation on Plugins and Multi-Project Builds in http://grails.github.io/grails-doc/latest/guide/plugins.html

Other way is to install plugin in local maven repository using gradle publishToMavenLocal command and resolve if from there, before publishing to Bintray or other dependency repository.

Additionally since Grails 3.1.1, reloading is now supported for 'inline' plugins. Check https://github.com/grails/grails-core/releases/tag/v3.1.1 and http://grails.io/post/138665751278/grails-3-gradle-multi-project-builds

It is done using grails { plugins { syntax. Copied from docs:

grails {
    plugins {
        compile ":hibernate"
        compile project(':myplugin')
    }
}
Neville answered 6/2, 2016 at 14:47 Comment(3)
where to put grails { plugins { in build.gradle file? Can you provide an example. A github or gist link would be fine.Pinot
We tend to put it before dependencies {} block, but it will work from anywhere but after required plugins are applied (apply plugin: lines)Neville
Check this link for how to use inlace plugins with grails 3, and do it conditionally based on some environment variable nimavat.me/code-snippets/how-to-use-grails3-inplace-pluginsIconostasis
P
0

This multi-project thing is a bit too big to answer in a short post. I just recently started with it, but, thankfully, I now have the hang of it. There's a tutorial on my site with a plugin handling the domain classes and services and all other sub-projects (just one, a web application in this example) using the plugin. The code is also downloadable. Here's the link: http://www.databaseapplications.com.au/grails-multi-app.jsp Make no mistake, there are a few things to watch out for.

Predominant answered 13/2, 2017 at 11:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.