Accessing git branch name in gradle
Here's an example build.gradle snippet that uses [gradle-git][1] to retrive the branch name, which is used to set the version.
buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath 'org.ajoberstar:gradle-git:1.1.0'
  }
}
apply plugin: 'java'
import org.ajoberstar.grgit.*
ext.repo = Grgit.open(project.file('.'))
version = "1.1-${ext.repo.branch.current.name}"Written by Lorin Hochstein
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Gradle 
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

 
 
 
