This is a gradle plugin that helps you easily do semantic versioning of java projects using gradle.
In the team I work with, we do not use Docker and instead deploy the .jar files directly. Because of this, we encountered situations where it became confusing to know which version a specific .jar file was during deployment, especially when the file itself didn't contain version information.
To address this, I decided to create a versioning library for .jar files that would be beneficial for all team members.
buildscript {
dependencies {
classpath files('libs/gradle-semantic-versioning-manager-plugin-0.1.0.jar')
}
}
plugins {
// ~~~
}
apply plugin: 'io.github.mainmethod0126.simple-semantic-version'
https://plugins.gradle.org/plugin/io.github.mainmethod0126.simple-semantic-version
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "io.github.mainmethod0126:app:0.1.0"
}
}
apply plugin: "io.github.mainmethod0126.simple-semantic-version"
Currently, the "Using the plugins DSL" method is not available. We will try to solve the problem as soon as possible.
gradlew build -Pmajor=++
gradlew build -Pminor=++
gradlew build -Ppatch=++
PrereleaseVersion Since version is in text format, incremental method is not supported.
BuildMetadataVersion Since version is in text format, incremental method is not supported.
gradlew build -Pmajor=1
gradlew build -Pminor=2
gradlew build -Ppatch=3
gradlew build -Ppr=beta
gradlew build -Pbm=test
gradlew build -Pjavav=17
gradlew build -Pmajor=1 -Pminor=2 -Ppatch=3 -Ppr=beta -Pbm=test -Pjavav=17
ssv {
buildDate = "2023-10-21";
isDateInBuildArtifactDirPath = true;
applicationVersion = "0.0.0";
}
Property name | Description | Default |
---|---|---|
ssv.buildDate |
This is the build date. | today |
ssv.isDateInBuildArtifactDirPath |
Indicates whether buildDate should be included in BuildArtifactDirPath . If true , a directory is created with the name buildDate . If false , no directory is created. |
false |
ssv.applicationVersion |
This is the application version. | The content of the version.json file if the version.json file exists. If the version.json file does not exist, the default value is "0.0.0". |
gradlew build -Pmajor=1 -Pminor=2 -Ppatch=3 -Ppr=beta -Pbm=test -Pjavav=17
<application root>/dist/<YYYY-MM-DD>/<java version>/<version>/app-<major.minor.patch>-<prereleaseVersion>-<buildMetadata>.jar
A folder called "dist" is automatically created in the application root path, and Build Artifacts are located under the "dist" folder. (If it already exists, the creation process is skipped)
The year, month, and day information of the build is created as a directory. (ex: 2023-02-07)
During gradle build, the java version entered through -Pjavav is created as a directory. (When the javav option is omitted, the build java version is used by default)
The directory is created with the final version information generated during Gradle build. (ex : app-1.2.3-beta-test)