4 Publishing Grails plugins - Reference Documentation
Authors: Peter Ledbrook
Version: 3.0.0
Table of Contents
4 Publishing Grails plugins
If you want to make your Grails plugins available to other people, then the best approach is to publish them using this plugin. The publication process is straightforward:- Package the plugin as a zip or jar
- Deploy it to a Maven or Subversion repository
- Optionally notify a plugin portal of the release
4.1 Publishing to Grails Central Plugin Repository
The most common use case for thepublish-plugin
command is to publish a public plugin so that it is available to all Grails users; well, to those that have an internet connection at least. Because of this, the command's default configuration is geared towards the Grails Central Plugin Repository. As long as you have a Grails.org account, simply installing the Release plugin and executinggrails publish-plugin
~/.grails/settings.groovy
:grails.project.repos.grailsCentral.username = "me" grails.project.repos.grailsCentral.password = "s0longf!shthanks"
4.2 Custom repositories and plugin portals
Not all plugins should be publicly available: some are too specific to certain projects while others are confidential. Still, teams can gain big advantages from deploying such plugins to their own private repositories. Because of that, the Release plugin can of course publish plugins to any target repository and even notify private plugin portals.Repository types and configuration
Grails supports two types of plugin repository: the traditional Subversion-based one and Maven-compatible. The public plugin repository is currently an example of the former. All you need to do is set up a standard Subversion repository and the Release plugin will do the rest.Maven-compatible ones can be easily set up with either Artifactory or Nexus. Subversion-based repositories are useful for older versions of Grails, but if you only use Grails 1.3 or above, we recommend you use a Maven-compatible repository for your plugins.Whichever type of repository you go for, the configuration settings are mostly the same. The key options are the repository URL and the username and password for deploying to the repository. All of these can be configured in either~/.grails/settings.groovy
or BuildConfig.groovy
. Typically, a single repository hosts many plugins, so it's usually a good idea to put the configuration in settings.groovy
and then specify in grails-app/conf/BuildConfig.groovy
which repository a plugin should be published to by default:grails.project.repos.default = "companyRepo"
grails.project.repos.default = "grailsCentral"
--repository
command line argument every time you publish a plugin, although you can still use it to override the default. For example, you may have a local Maven-compatible repository you want to test deployment to, so you could configure it in settings.groovy
and then run:grails publish-plugin --repository=localReleases
type
configuration option. Just set it to "svn".Your own plugin portal
How would you like your own plugin portal for your private plugins? You'll be able to see what plugins are available, tag them and do searches. The public plugin portal at grails.org is part of that web site, but it's also an open source project on GitHub. There are also plans to extract the plugin portal so that it can be used independently of the grails.org web site.Currently, your best option if you want your own portal is to grab a copy of the grails.org source code and run your own version locally. It's a Grails application, so it's not hard to get it started. Once it's up and running, it provides a REST API that the Release plugin can use for plugin release notifications. The portal updates the information for the given plugin and then announces the release in various ways. You'll probably want to disable the announcements, which you can do by modifying the PluginUpdateService.announceRelease() method.Configuring the Release plugin to notify your own portal is straightforward and described in the configuration section. Remember, you can specify a default portal for each project and you can also override that default via the--portal
command line argument.