nimavat.me

Java, Groovy, Grails, Spring, Vue, Ionic + Fun blog

Publishing Grails 3 plugins to artifactory

|

Grails reference docs explains how to publish plugins to bintray. However there’s no information about how to publish the artifacts to artifactory or any other maven compatible repository.

Grails 3 project is actually a gradle project, so Maven publication can be used to publish artifacts to artifactory.  Grails gradle plugin already configures the Maven publication, so all you need to do is configure the maven repository url and credentials to be able to publish your plugin to artifactory.

File build.gradle

    publishing {
        repositories {
            maven {
                url "http://myserver.com/artifactory/grails-plugins" //change to your maven repo url
                credentials {
                    username "$artifactoryUsername"
                    password  "$artifactoryPassword"
                }
            }
        }
    }

File gradle.properties

    artifactoryUsername=username
    artifactoryPassword=password

or even better, you can put the artifactory username/password inside ~/.gradle/gradle.properties so it can be shared by all the projects.

And finally run the command

    gradle publish

Gradle will build the jar and publish it to configured maven repository.