How to setup automatic versioning of plugin according to the build

I took responsibility for plugin sonar-scm-tfvc. Im new in sonarqube plugin development and also in using maven.

I would like to establish (semi) automatic versioning of the plugin similar to popular plugins like sonar-cxx: With each build the plugin should get “build version” number incremented. This should be visible in file name (e.g. sonar-scm-tfvc-plugin-2.3-1234.jar) and plugin metadata (e.g. 2.3 (build 1234)).

Who can help?

Hi Lukas,

The build number is provided by the CI service, AppVeyor in the case of sonar-scm-tfvc. This number should be used to replace the version defined in Maven when building sources. Here is an example of script that does that: https://github.com/SonarSource/travis-utils/blob/master/bin/set_maven_build_version. It can be used like that.

HIH

1 Like

Projects like sonar-cxx seems NOT to have such script. It seems to work with one of the extensions configured in pom.xml files. But I’m unable to identify the right one.

Sure, it was just an example to be considered as a source of inspiration.

Thanks, Simon.
Hope somebody can explain me how to use one of the maven plugins to get the mentioned build information without individual script to be executed.