diff options
author | David Rautureau <david.rautureau@sonarsource.com> | 2017-01-06 10:21:29 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-01-11 11:20:36 +0100 |
commit | e6d78a732aba76e1a5ef330c1bf6565eb6775ee9 (patch) | |
tree | 56e6e5b80eb8e25e3d3c65e4465f3870f83b5692 /sonar-plugin-api | |
parent | e1eaa719e95a20438dda7516797d155db1c3b56c (diff) | |
download | sonarqube-e6d78a732aba76e1a5ef330c1bf6565eb6775ee9.tar.gz sonarqube-e6d78a732aba76e1a5ef330c1bf6565eb6775ee9.zip |
SONAR-8458 store semantic version in sq-version.txt
Scanners load the file sq-version.txt to get the
version of SonarQube. Some scanners, for example Maven,
do not correctly support the new format on 4 fields.
For this reason a 3-digits format must be kept for
backward-compatibility. The complete version in the
new format is available in the new file
sonar-api-version.txt
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/pom.xml | 33 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/resources/sq-version.txt | 2 |
2 files changed, 34 insertions, 1 deletions
diff --git a/sonar-plugin-api/pom.xml b/sonar-plugin-api/pom.xml index cddd24b91af..2cef8a0681f 100644 --- a/sonar-plugin-api/pom.xml +++ b/sonar-plugin-api/pom.xml @@ -13,6 +13,10 @@ <name>SonarQube :: Plugin API</name> + <properties> + <project.version.3digits>${project.version}</project.version.3digits> + </properties> + <dependencies> <!-- @@ -213,6 +217,35 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>groovy-maven-plugin</artifactId> + <executions> + <execution> + <id>compute-3digits-version</id> + <phase>generate-resources</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <source><![CDATA[ + if (! "${project.version}".endsWith("-SNAPSHOT")) { + String apiVersion + // example: "6.3.0.1234". To be backward-compatible with scanners, only "6.3.0" must be kept + String[] fields = "${project.version}".tokenize('.') + if (fields.length > 3) { + apiVersion = fields[0..2].join('.') + } else { + apiVersion = fields.join('.') + } + project.properties['project.version.3digits'] = apiVersion + } + ]]> + </source> + </configuration> + </execution> + </executions> + </plugin> </plugins> <resources> diff --git a/sonar-plugin-api/src/main/resources/sq-version.txt b/sonar-plugin-api/src/main/resources/sq-version.txt index ad96e7cf933..b9ca09a01c9 100644 --- a/sonar-plugin-api/src/main/resources/sq-version.txt +++ b/sonar-plugin-api/src/main/resources/sq-version.txt @@ -1 +1 @@ -${project.version} +${project.version.3digits}
\ No newline at end of file |