This is a lightweight Java Maven package that provides runtime access to the current version of the library. This is achieved through the following features:
- Programmatically retrieves the current version from
pom.xml. - Automatically injects the version into
version.propertiesduring the Maven build process.
To install the library in your Java project, add the following to your pom.xml:
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/remla25-team6/lib-version</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.remla25team6</groupId>
<artifactId>lib-version</artifactId>
<version>1.4.0</version> <!-- or latest -->
</dependency>
</dependencies>You will also need a settings.xml file with GitHub credentials for authentication.
After installation, you can retrieve the current version in Java using:
import org.remla25team6.version.VersionUtil;
public class App {
public static void main(String[] args) {
System.out.println("Version: " + VersionUtil.getVersion());
}
}The version is resolved from the version.properties file. At build time, Maven replaces this placeholder with the actual version defined in pom.xml.
This project uses GitHub Actions for automated releases.
To publish an official release:
- Ensure all changes are committed and pushed to any desired
releasebranch. - Tag the commit with a version like
v1.0.0and push:git tag v1.0.0 git push origin v1.0.0
- This triggers the
release.ymlworkflow, which:- Updates the
pom.xmlversion. - Builds the Maven package.
- Publishes it to GitHub Packages.
- Updates the
To publish a pre-release:
- Push a commit to the
mainbranch (i.e. merge a pull request to themainbranch). - The
prerelease.ymlworkflow automatically runs on every commit tomain. - It builds the package creates a pre-release using the current timestamp (e.g.,
0.1.0-pre.20250625.123456). - The packages are available on GitHub packages.
Used ChatGPT-4o to refine README. Additionally, ChatGPT-4o was used to help generate the release.yml file, specifically the logic to authenticate with the Github Packages registry.