4

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

Rob Bugh
  • 61
  • 3

2 Answers2

1

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.

Ryan V
  • 41
  • 2
  • Is this still valid ? Looks like we no longer need to manually stripout the dependencies. Just configuring a maven repo and credentials and thn doing gradle publish works with release or snapshots -- http://nimavat.me/blog/how-to-publish-grails3-plugins-to-artifactory – Sudhir N Jul 17 '17 at 08:50
1

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
Duncan
  • 131
  • 1
  • 4
  • A whole build.gradle can be found here: https://raw.githubusercontent.com/duncanscott/buildscript/master/build.gradle – Duncan Jul 12 '17 at 06:53
  • 1
    Worked for me in 2019 (nice to avoid the artifactory gradle plugin) – pmc Aug 15 '19 at 05:03