Version Utility Notes

Whenever I build a Spring Boot server, I always name the jar file similar to application-1.10.00.jar. This avoids any confusion when copying it to a production server for deployment, and allows easy rollback if there is a problem. For example, I have a couple deployments of application on a production server:

$ ls -l
total 140720
lrwxrwxrwx application.jar -> application-0.40.01-alpha.2+0102.jar
-rw-rw-r-- application-0.39.00-alpha.2+0100.jar
-rw-rw-r-- application-0.40.00-alpha.2+0101.jar
-rw-rw-r-- application-0.40.01-alpha.2+0102.jar

You can clearly see the version, in the correct alphabetical order, and any time a version is created the build number will be different. So if application-0.40.01-alpha.2+0102.jar had an error while building/uploading, I can upload the same version but different build number.

Having the output file named correctly and a matching version number in the application was always a bit tedious, as I didn't like the idea of doing it manually, so I decided to create a quick utility.

I had AI create the initial version, as I knew that was just a bunch of grunt work to read the command line arguments, read and parse the JSON files, and output the various language version files. AI surprised me with a very complete implementation of the _generate() method that creates the actual version file. I thought the // GENERATED FILE - DO NOT EDIT was a nice touch.

With the initial version created, I added a few more parameters, and updated the version string output to match what I was looking for. Then after studying SemVer a little closer, I added the prerelease tag and reformatted how the build is added to the version string.

Once I started using GitHub actions I added the ability to output strict SemVer version numbers, since some CI/CD systems don't like the padded zeros.

AI was great to get the initial version created, and help me research and understand how to correctly implement SemVer versioning.