A version object for C Thing Software projects. This is a semantic version with additional build identification information. The additional information indicates the build type and whether the build is being performed by the C Thing Software Continuous Integration service or on a developer's machine. The following versioning scheme is used:
Build Environment | Requested Build Type | Actual Build Type | Semantic Version |
---|---|---|---|
CTHING_CI undefined (i.e. developer build) | snapshot | snapshot | n.n.n-0 |
CTHING_CI defined (i.e. CI build) | snapshot | snapshot | n.n.n-t (t = ms since Unix Epoch) |
CTHING_CI undefined | release | snapshot | n.n.n-0 |
CTHING_CI defined | release | release | n.n.n |
The library is available from Maven Central using the following Maven dependency:
<dependency>
<groupId>org.cthing</groupId>
<artifactId>cthing-projectversion</artifactId>
<version>2.0.0</version>
</dependency>
or the following Gradle dependency:
implementation("org.cthing:cthing-projectversion:2.0.0")
The typical usage of this class is to set the version in Gradle build files for C Thing Software projects.
import org.cthing.projectversion.BuildType
import org.cthing.projectversion.ProjectVersion
...
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath(libs.cthingProjectVersion)
}
}
...
version = ProjectVersion("1.2.3", BuildType.snapshot)
...
The library is compiled for Java 17. If a Java 17 toolchain is not available, one will be downloaded.
Gradle is used to build the library:
./gradlew build
The Javadoc for the library can be generated by running:
./gradlew javadoc
This project is released on the Maven Central repository. Perform the following steps to create a release.
- Commit all changes for the release
- In the
build.gradle.kts
file- Ensure that
baseVersion
is set to the version for the release. The project follows semantic versioning. - Set
isSnapshot
tofalse
- Ensure that
- Commit the changes
- Wait until CI builds the release candidate
- Run the command
mkrelease cthing-projectversion <version>
- In a browser go to the Maven Central Repository Manager
- Log in
- Use the
Staging Upload
to upload the generated artifact bundlecthing-projectversion-bundle-<version>.jar
- Click on
Staging Repositories
- Once it is enabled, press
Release
to release the artifacts to Maven Central - Log out
- Wait for the new release to be available on Maven Central
- In a browser, go to the project on GitHub
- Generate a release with the tag
<version>
- In the build.gradle.kts file
- Increment the
baseVersion
patch number - Set
isSnapshot
totrue
- Increment the
- Update the
CHANGELOG.md
with the changes in the release and prepare for next release changes - Update the
Usage
section in theREADME.md
with the latest artifact release version - Commit these changes