diff options
-rw-r--r-- | pom.xml | 5 | ||||
-rw-r--r-- | sonar-plugin-api/pom.xml | 33 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/resources/sq-version.txt | 2 |
3 files changed, 39 insertions, 1 deletions
@@ -107,6 +107,11 @@ <version>1.3</version> </plugin> <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>groovy-maven-plugin</artifactId> + <version>2.0</version> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> 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 |