alexgorbatchev

Tuesday, November 8, 2016

Add custom Nexus Repository OSS to your Grails 3 Gradle build

After creating Grails 3 plugins and publishing them to your private/public Nexus Repository OSS server, you will want to use them in your projects. To use your custom Grails 3 plugins just add the following closure block to the repositories closure in build.gradle:

As with previous examples, NEXUS_USERNAME and NEXUS_PASSWORD are project parameters that you can store in gradle.properties file or pass on the command line.

Publishing Grails 3 plugins to Nexus Repository OSS using Gradle

To publish a Grails 3 plugin to Nexus Repository OSS is extremely simple because the necessary Gradle plugin is already included in the build.gradle file by default. Just add a publishing closure to the build.gradle file and you are ready to push to your private Nexus Repository OSS server.

As in the Grails application publishing example, the NEXUS_USERNAME and NEXUS_PASSWORD keywords are parameters that you store in gradle.properties and can overwrite with command line parameters, such as

** Edit **

Per Amad's comments, the grailsPublish closure may be required. I modified the attributes in the closure supplied by the create-plugin script as follows:

Publishing Grails 3 applications to Nexus Repository OSS using Gradle

To publish a Grails 3 application to Nexus Repository OSS you just need to make a few tweaks to the build.gradle file.  Just add the Gradle maven-publish plugin and a publishing closure to the build.gradle file and you are ready to push to your private Nexus Repository OSS server.

Above, the NEXUS_USERNAME and NEXUS_PASSWORD are parameters that you store in gradle.properties and can overwrite with command line parameters, such as