Gradle (YA) Release plugin

Yet another Gradle Release plugin.

License

License

Categories

Categories

Gradle Build Tools
GroupId

GroupId

com.github.prokod
ArtifactId

ArtifactId

gradle-yar-plugin
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

Gradle (YA) Release plugin
Yet another Gradle Release plugin.
Project URL

Project URL

http://github.com/prokod/gradle-yar-plugin
Source Code Management

Source Code Management

https://github.com/prokod/gradle-yar-plugin

Download gradle-yar-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.prokod/gradle-yar-plugin/ -->
<dependency>
    <groupId>com.github.prokod</groupId>
    <artifactId>gradle-yar-plugin</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.prokod/gradle-yar-plugin/
implementation 'com.github.prokod:gradle-yar-plugin:0.2.0'
// https://jarcasting.com/artifacts/com.github.prokod/gradle-yar-plugin/
implementation ("com.github.prokod:gradle-yar-plugin:0.2.0")
'com.github.prokod:gradle-yar-plugin:jar:0.2.0'
<dependency org="com.github.prokod" name="gradle-yar-plugin" rev="0.2.0">
  <artifact name="gradle-yar-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.prokod', module='gradle-yar-plugin', version='0.2.0')
)
libraryDependencies += "com.github.prokod" % "gradle-yar-plugin" % "0.2.0"
[com.github.prokod/gradle-yar-plugin "0.2.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.eclipse.jgit : org.eclipse.jgit jar 3.3.1.201403241930-r
org.tmatesoft.svnkit : svnkit jar 1.8.3-1

Project Modules

There are no modules declared in this project.

Gradle (Yet Another) Release plugin

Inspired by other Gradle release plugins out there already, This plugin is aiming for simplicity while providing some finer settings in the form of changing tagging format for instance.

Usage

Quick startup guide:

1. Add the following to your build.gradle file:

buildscript {
  repositories {
    mavenCentral()
  }

  dependencies {
    classpath 'com.github.prokod:gradle-yar-plugin:0.2.0'
  }
}

apply plugin: 'ya-release'

release {
  failOnSnapshotDependencies = true
  allowLocalModifications = false
  releaseDryRun = false
  scm = 'git'
  username = 'star-lord'
  password = 'earthling'
  taggingFormat = '#{b}-RELEASE-#{v}'
}

version = release.projectVersion
  1. Include the buildscript section to pull this plugin into your project.
  2. Apply the plugin.
  3. Add release section to change yar default settings
Available settings are:

* failOnSnapshotDependencies: default is true. Will fail the release task if any dependency is currently pointing to a SNAPSHOT
* allowLocalModifications: defaults to false. Will fail the release task if any uncommitted changes remain in your local version control. This prevents you from releasing a build which you cannot later reproduce because you don't have the complete set of source which went into the build.
* releaseDryRun: this skips the commit of the tag to your version control system
* scm: 'git' or 'svn'
* username: a username for your version control system. This is mostly useful for running releases from a continuous integration server like Jenkins. If you don't pass this, the release plugin will take credentials from any cached on your system or prompt you for them.
* password: a password to match the username
* taggingFormat: Any string that may include the following expressions #{b} for branch name #{v} for release projectVersion
  1. Optional: Setting your project version from the output of this plugin - When opting for this, make sure the above code is at the top of the build.gradle file.

2. Calling release task from command line:

A typical use case to build a project would be to test, tag and upload their release artifacts:

gradle release publish

3. Gotchas

In a multi module project you should apply this plugin only once in the root build.gradle otherwise gradle will fail while trying to tag the same tag multiple times.

Properties

You can access two properties from this plugin once you have applied it:

release.projectVersion Read only property for getting the version of this project. The version is derived from the following rules: 1. If the releaseVersion property was passed to gradle via the -P command line option, then use that. 2. If the version control system is currently pointing to a tag, then use a version derived from the name of the tag 3. Use the name of the branch (or trunk/head) as the version appended with "-SNAPSHOT"

release.scmVersion Read only property for getting the version from the source control system. This will return the git hash (or the svn commit number) for the current state of the local repository. This value may be useful for as an entry in a Jar's manifest file (it can be more reliable than the public-facing branch/version string.

Tasks

Tasks

Task Depends on Type Description
release - Task Project version numbering (using exposed property release.projectVersion) and release tagging (currently git and svn are supported)

Release notes

Versions

Version
0.2.0