Rob Bugh
Rob Bugh

Reputation: 71

Grails 3 - How to publish to Artifactory

I have several Grails 3 projects. Most are plugins and one is the main app that depends on the plugins.

Can someone who has successfully published a Grails 3 project to an Artifactory repo tell me how you did it? What gradle plugin do you use and what do you need to add to your build.gradle to make it work?

Regards, Rob

Upvotes: 4

Views: 1412

Answers (2)

Duncan
Duncan

Reputation: 176

I just started working with grails 3, specifically version 3.2.8.

I found that placing the following entry at the end of build.gradle works where artifactory_user, artifactory_password, artifactory_snapshotUrl, and artifactory_releaseUrl are defined in gradle.properties.

publishing {
    repositories {
        maven {
            credentials {
                username artifactory_user
                password artifactory_password
            }
            if (version.endsWith('SNAPSHOT')) {
                url artifactory_snapshotUrl
            } else {
                url artifactory_releaseUrl
            }
        }
    }
}

File gradle.properties reads:

grailsVersion=3.2.8
grailsWrapperVersion=1.0.0
gormVersion=6.0.9.RELEASE
gradleWrapperVersion=3.4.1

app_version=0.0.1-SNAPSHOT
artifactory_user=admin
artifactory_password=password
artifactory_contextUrl=http://myserver.myorg.org:8081/artifactory
artifactory_snapshotUrl=http://myserver.myorg.org:8081/artifactory/libs-snapshot-local
artifactory_releaseUrl=http://myserver.myorg.org:8081/artifactory/libs-release-local

Upvotes: 1

Ryan V
Ryan V

Reputation: 41

I blogged the answer:

http://rvanderwerf.blogspot.com/2015/07/how-to-publish-grails-3-plugin.html

Basically you need to strip out anything in the POM with no version on it as Grails/Boot managed those deps.

Upvotes: 1

Related Questions