Gradle -release plugin + maven publishing plugin

I create gradle as a new gradle user, but I have worked with maven in the past.

I am trying to reproduce the actions of the maven release plugin:

  • Change the branch version to release number (commit at svn)
  • Create tag (on svn)
  • Expand the release tag in Nexus OSS
  • Change the version of a branch to a new snapshot number (commit at svn)

As you can see, I use:

  • Nexus OSS as a version repository
  • SVN as scm
  • Gradle (2.8)

I am trying to achieve my goals with these two plugins:

  • Gradle -release Plugin :

    • Change the branch version to release number (commit at svn)
    • Create tag (on svn)
    • Change the version of a branch to a new snapshot number (commit at svn)

    Command line: Gradle release

  • Maven Publish plugin for deployment on Nexus:

    Command Line: Gradle Publish

Any ideas on how I can generate the release and automatically deploy it to Nexus in one shot?

Below is my build.gradle:

plugins { id 'net.researchgate.release' version '2.3.4' } apply plugin: 'maven-publish' /*------------------------ ----- PUBLISH PLUGIN ----- -------------------------- https://docs.gradle.org/current/userguide/publishing_maven.html --------------------------*/ publishing { publications { maven(MavenPublication) { groupId mavenGroup artifactId mavenArtifact version version from components.java } } repositories { maven { if(project.version.endsWith('-SNAPSHOT')) { url "${nexusUrl}/content/repositories/repo-snapshots" } else { url "${nexusUrl}/content/repositories/repo-releases" } credentials { username nexusUsername password nexusPassword } } } } /*------------------------ ----- RELEASE PLUGIN ----- -------------------------- https://github.com/researchgate/gradle-release --------------------------*/ release { failOnCommitNeeded = false failOnUnversionedFiles = false scmAdapters = [ net.researchgate.release.SvnAdapter ] } 
+5
source share
1 answer

You need to configure the dependency between the two tasks. This can be done by adding this line to your build.gradle :

 afterReleaseBuild.dependsOn publish 

There are two tasks in the release plugin that are exactly designed to use other tasks in the release process, namely beforeReleaseBuild and afterReleaseBuild . These tasks (and the dependencies you installed) are performed before or after the build task.

https://github.com/researchgate/gradle-release#custom-release-steps

+10
source

Source: https://habr.com/ru/post/1236594/


All Articles