qoomon / maven-git-versioning-extension

This extension will set project version, based on current Git branch or tag.
GNU General Public License v3.0
305 stars 87 forks source link

Select newest/highest version tag for building #250

Closed cboehme closed 1 year ago

cboehme commented 1 year ago

I have come across an issue when building a commit which has multiple tags which are matched by a single ref config. I excepted that the maven-git-versioning-extension would select the newest tag or the highest version number. However, the tag representing the lowest version number was selected.

To illustrate: a commit is tagged with release/3.0.0 and release/3.0.1. When building this commit I expect release 3.0.1 to be built but instead version 3.0.0 is built.

I think the problem is in line 750 in GitVersioningModelProcess, where the list of tags is sorted ascendingly by the comparator defined by DefaultArtifactVersion. Before this sort happens the list of tags is sorted by the order defined in TagComparator (called in line 150 in GitUtil.java). The order defined in TagComparator is the one I expect to be used when selecting the tag for building.

qoomon commented 1 year ago

Should be fixed in version 9.6.6 :-) Thanks for reporting