Skip to content

EAlOne/version-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

version-info

This project VersionInfo is gradle plugin for automatic version generation from Java Properties file.

How it use

There are two ways how add this plugin into your project, first of them download this project, build and publish to your local Maven repository, another way include this repository as remote.
After you apply the plugin, you will be able to access three tasks:

  • updateProjectVersion
  • printBuildNumber
  • incBuildNumber

updateProjectVersion - Set version to the project.version field
printBuildNumber - Print full version to log output
incBuildNumber - Increment build number and save full version to the version.properties file

The project's root folder must contain the version.properties file.

#Generated by Version Info Plugin for Gradle
#Mon Jan 1 00:00:00 MSK 2018
major=1
middle=0
minor=0
suffix=
build=100

Publish to Local Maven repository

git clone https://github.com/EAlOne/version-info.git
cd ./version-info
gradle clean build publishToMavenLocal

Example build.gradle:

buildscript {
   repositories {
       mavenCentral()
       mavenLocal()
   }
   dependencies {
       classpath("ru.ealone.gradle.plugins:version-info:x.x.x")
   }
}

apply plugin: 'version-info'
...

Include remote repository

Alternatively you can use remote repository that contains this plugin.
Example build.gradle:

buildscript {
   repositories {
       mavenCentral()
       maven {
           url 'https://github.com/EAlOne/vcs-repo/raw/master'
       }
   }
   dependencies {
       classpath("ru.ealone.gradle.plugins:version-info:x.x.x")
   }
}

apply plugin: 'version-info'
...

Typically use

buildscript {
    repositories {
        mavenCentral()
        maven {
            url 'https://github.com/EAlOne/vcs-repo/raw/master'
        }
    }
    dependencies {
        classpath("ru.ealone.gradle.plugins:version-info:1.1.0")
    }
}

apply plugin: 'java'
apply plugin: 'version-info'

group = 'your.group'
sourceCompatibility = 1.8

repositories {
	mavenCentral()
}

dependencies {
    ...
}

/*
 *  ==================== Tasks ====================
 */
task yourCustomTask(){
    ...
}

task buildExecutor
buildExecutor.dependsOn 'incBuildNumber'
buildExecutor.dependsOn 'printBuildNumber'

jar {
    dependsOn 'buildExecutor'
    dependsOn 'updateProjectVersion'
}

License

GNU General Public License v3.0

About

Gradle plugin for automatic version generation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages