Confused about the utility of "version"

I asked this question on github:

Im still unclear on what version does and why i should set it
For java I dont set it at all and it picks it up from the pom
For windows I generate a timestamp and have the scanner use that as the version

Am I doing this right? What if I didnt set the version on windows or java scans? I’m really confused about how this works and how it works with branches.

I just assumed every time I scan the scanner ships that analysis to the server and it sees that as a new scan. If I dont set the version does sonar server clobber the current scan? What would that do just prevent me from getting historical metrics for scans over time?

should i set the version to a timestamp for ALL scans of all platforms?

I think i might understand this more. Is the whole idea of new code period irrelevant if im using trunk based development with feature branches? because right now every feature branch is already compared to the “main” branch- seems like thats all I need. Not sure how new code period fits into this

As far as I know, the scanner picks up the version from the AssemblyInfo file. So it seems to me you don’t need to specify a version manually with an explicit timestamp.

The purpose of the version is to track issues introduced in the “leak period”, typically since the previous release. The idea is to focus on keeping the new issues since the last release under control, to ensure good quality of new development.

I think i finally understand

For my purposes the release version makes sense but that means I need to manually configure the project version to only use to base version. Maven plugin sets the scan version automatically but it includes snapshots. I never got windows scanner to pick up the assembly version for project version though