Version-aware Maven library for SMS Checker application (F1 Implementation)
This library provides version information utilities for the SMS Checker project. It demonstrates how to create and reuse a library with version awareness capabilities.
- VersionUtil class that can be asked for its version
- Version information stored in resource file (not VCS-dependent)
- Thread-safe singleton pattern
- Useful for monitoring and system information display
- Version-aware Maven library
- VersionUtil class with getVersion() method
- Version parsed from metadata/resource file
- No dependency on version control system
- Used by app service for library reuse demonstration
- GitHub Actions workflow for automatic packaging
- Automatic versioning from Git tags
- Release to GitHub Packages (Maven registry)
- Automated release notes generation
Add this repository configuration to your pom.xml:
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/doda25-team6/lib-version</url>
</repository>
</repositories>Add the dependency:
<dependency>
<groupId>team6</groupId>
<artifactId>lib-version</artifactId>
<version>1.0.0</version>
</dependency>Configure authentication in ~/.m2/settings.xml:
<servers>
<server>
<id>github</id>
<username>YOUR_GITHUB_USERNAME</username>
<password>YOUR_GITHUB_TOKEN</password>
</server>
</servers>Note: YOUR_GITHUB_TOKEN must have read:packages scope.
mvn clean installimport team6.version.VersionUtil;
// Get version information
VersionUtil versionUtil = VersionUtil.getInstance();
String version = versionUtil.getVersion();
String buildTime = versionUtil.getBuildTime();
String fullInfo = versionUtil.getFullVersionInfo();
System.out.println("Version: " + version);
System.out.println("Build Time: " + buildTime);
System.out.println("Full Info: " + fullInfo);mvn clean compile
mvn package
mvn install # Install to local repository for use by appThe library is automatically released to GitHub Packages when you push a version tag:
# Create and push a version tag
git tag v1.0.0
git push origin v1.0.0The GitHub Actions workflow will:
- Extract version from the tag
- Update
pom.xmlversion - Update
version.propertieswith version and build time - Build and test the library
- Publish to GitHub Packages
- Create a GitHub Release with release notes
To manually publish to GitHub Packages:
# Set GitHub token
export GITHUB_TOKEN=your_token_here
# Deploy
mvn deployThis library is used by the SMS Checker app service to demonstrate library reuse and provide system information for monitoring purposes.