This project VersionInfo is gradle plugin for automatic version generation from Java Properties file.
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
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'
...
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'
...
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'
}
GNU General Public License v3.0