lunes, mayo 19, 2014

Grails, reusing domains with a binary plugin

How should I do in order to reuse my domains?
Use your own domain's plugin, this is how.

Just create your plugin:

grails create-plugin book-remote
...{work as usual with your domains}...

Change your groupId/version and set binary as default type of packaging:

BookRemoteGrailsPlugin.groovy:

String groupId = 'com.nortia.book'
String version = '0.1'
String packaging = 'binary'

Install into local maven repo (or wherever you want to):

grails  maven install --binary


Then, you have include your plugin as a dependency for your grails app:

BuildConfig.groovy:
    dependencies {
    //Since it is  binary plugin is goes here instead of in the 'plugins' section
compile 'com.nortia.book:book-remote:0.1'
    }


That's it! :D
PD: There is no need for the plugin to be 'binary' unless you're planning to use those domains in another groovy (no grails) project (which was my case).

No hay comentarios: