Search code examples
javamavengrailsgroovygrails-plugin

Install Plugin jar in Grails Project?


I have a grails plugin project and want to make a jar which I then include into my grails project.

Here is the plugin project: https://github.com/ticketbis/grails-groobalize

I did:

grails package-plugin --binary

To get the file: grails-plugin-groobalize-0.1.12.jar.

In my grails project's BuildConfig.groovy I did:

dependencies {
  compile "com.ticketbis:groobalize:0.1.12"
}

When I run grails refresh-dependencies I get the following error:

Error |
There was an error loading the BuildConfig: Bad artifact coordinates :groobalize:0.1.12, expected format is <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version> (Use --stacktrace to see the full trace)

How do I install the locale plugin jar into ma grails project correctly?


Solution

  • There are a few ways of doing this.

    You can use the release plugin: https://grails.org/plugin/release

    • Add this plugin to your grails plugin and then do a publish. The plugin will then be added to your local maven repo.
    • The you could add the dependency in your main grails project as you have already done.

    Other way around is to checkout the plugin project, include the location in your main grails project like below.

    BuildConfig.groovy

    grails.plugin.location.'your-plugin' = "<location-your-plugin>"
    

    This line will compile your plugin every time you compile your main grails project.

    There may be other ways too.