6.3 Publishing Profiles

Publishing Profiles to the Grails Central Repository

Any profile created with the create-profile command already comes configured with a grails-profile-publish plugin defined in build.gradle:

  1. apply plugin: "org.grails.grails-profile-publish"

To publish a profile using this plugin to the Grails central repository first upload the source to Github (closed source profiles will not be accepted). Then register for an account on Bintray and configure your keys as follows in the profile’s build.gradle file:

  1. grailsPublish {
  2. user = 'YOUR USERNAME'
  3. key = 'YOUR KEY'
  4. githubSlug = 'your-repo/your-profile'
  5. license = 'Apache-2.0'
  6. }
The githubSlug argument should point to the path to your Github repository. For example if your repository is located at https://github.com/foo/bar then your githubSlug is foo/bar

With this in place you can run gradle publishProfile to publish your profile:

  1. $ gradle publishProfile

The profile will be uploaded to Bintray. You can then go the Grails profiles repository and request to have your profile included by clicking "Include My Package" button on Bintray’s interface (you must be logged in to see this).

Publishing Profiles to an Internal Repository

The aforementioned grails-profile-publish plugin configures Gradle’s Maven Publish plugin. In order to publish to an internal repository all you need to do is define the repository in build.gradle. For example:

  1. publishing {
  2. repositories {
  3. maven {
  4. credentials {
  5. username "foo"
  6. password "bar"
  7. }
  8. url "http://foo.com/repo"
  9. }
  10. }
  11. }

Once configured you can publish your plugin with gradle publish:

  1. $ gradle publish