In your plugin project you will need to add a new file BuildConfig.groovy under grails-app/conf.
As you probably guessed from the name, this file is used to customize the behavior of the grails build system. Among other things this file allows you to get dependencies from maven /ivy repositories (grails 1.2 only), use plugin repositories, and change the base directories for your plugins.
You need to add a couple of lines to this file to tell grails where to publish the plugin, and resolve other plugins.
grails.plugin.repos.discovery.myRepository="http://url-to-repository.com" grails.plugin.repos.distribution.myRepository="http://url-to-repository.com"
If you are using authentication on your repository, and you do not wish to be prompted every time you build you can include the username and password as part of your url.
Note grails assumes you are using authentication if you are using https as your protocol.
grails.plugin.repos.discovery.myRepository="https://username:password@url-to-repository.com" grails.plugin.repos.distribution.myRepository="https://username:password@url-to-repository.com"
I recommend using the BuildConfig.groovy file as it makes your build more portable. However you can also set this information for all projects using the USER_HOME/.grails/settings.groovy
Now that you have configured your plugin, you can publish it to the repository using the grails release-plugin command. You have to provide an argument of what repository to use.
grails release-plugin -repository=myRepository
Tip: Due to a bug in grails, if you are using windows you have to add quotes around your arguments grails release-plugin "-repository=myRepository"
When you run this command grails will import your plugin into subversion with the following structure.
- /.plugin-meta/plugins-list.xml (This file is updated each time you release a new version of a plugin it)
- /grails-
/tags/LATEST_RELEASE (This is automatically updated everytime you release) - /grails-
(This is used to resolve specific versions of your plugin)/tags/ - /grails-
/trunk/ (This is the latest working copy. You should check this out to make changes to your plugin)
Finally you need to add a BuildConfig.groovy file to your projects where you wish to use this plugin. This file needs to contain the discovery url for your plugin repository.
grails.plugin.repos.discovery.myRepository="http://url-to-repository.com"You will now be able to use the list-plugins and install-plugin commands on your in-house repository.