aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build.gradle2
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/config/SonarQubeVersionHelper.java2
-rw-r--r--server/sonar-main/src/main/resources/sonarqube-version.txt1
-rw-r--r--sonar-plugin-api-impl/build.gradle7
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/internal/MetadataLoader.java6
-rw-r--r--sonar-plugin-api-impl/src/main/resources/sq-version.txt1
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java2
7 files changed, 14 insertions, 7 deletions
diff --git a/build.gradle b/build.gradle
index 00825518e65..de436745c67 100644
--- a/build.gradle
+++ b/build.gradle
@@ -172,7 +172,7 @@ subprojects {
dependency 'org.sonarsource.kotlin:sonar-kotlin-plugin:2.9.0.1147'
dependency 'org.sonarsource.slang:sonar-ruby-plugin:1.9.0.3429'
dependency 'org.sonarsource.slang:sonar-scala-plugin:1.9.0.3429'
- dependency 'org.sonarsource.api.plugin:sonar-plugin-api:9.5.0.29'
+ dependency 'org.sonarsource.api.plugin:sonar-plugin-api:9.5.0.71'
dependency 'org.sonarsource.xml:sonar-xml-plugin:2.5.0.3376'
dependency 'org.sonarsource.iac:sonar-iac-plugin:1.7.0.2012'
dependency 'org.sonarsource.text:sonar-text-plugin:1.0.0.120'
diff --git a/server/sonar-main/src/main/java/org/sonar/application/config/SonarQubeVersionHelper.java b/server/sonar-main/src/main/java/org/sonar/application/config/SonarQubeVersionHelper.java
index d87776999c5..c2bd53147cf 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/config/SonarQubeVersionHelper.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/config/SonarQubeVersionHelper.java
@@ -27,7 +27,7 @@ import java.nio.charset.StandardCharsets;
import static java.lang.String.format;
public class SonarQubeVersionHelper {
- private static final String SONARQUBE_VERSION_PATH = "/sonarqube-version.txt";
+ private static final String SONARQUBE_VERSION_PATH = "/sq-version.txt";
private static String sonarqubeVersion;
diff --git a/server/sonar-main/src/main/resources/sonarqube-version.txt b/server/sonar-main/src/main/resources/sonarqube-version.txt
deleted file mode 100644
index 6b7ce460f25..00000000000
--- a/server/sonar-main/src/main/resources/sonarqube-version.txt
+++ /dev/null
@@ -1 +0,0 @@
-${buildVersion}
diff --git a/sonar-plugin-api-impl/build.gradle b/sonar-plugin-api-impl/build.gradle
index 4acfafdc0e1..553e644268d 100644
--- a/sonar-plugin-api-impl/build.gradle
+++ b/sonar-plugin-api-impl/build.gradle
@@ -25,6 +25,13 @@ dependencies {
testCompile 'org.mockito:mockito-core'
}
+import org.apache.tools.ant.filters.ReplaceTokens
+processResources {
+ filter ReplaceTokens, tokens: [
+ 'project.version': project.version
+ ]
+}
+
artifactoryPublish.skip = false
publishing {
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/internal/MetadataLoader.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/internal/MetadataLoader.java
index 40ccad10e31..33dae76c3f8 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/internal/MetadataLoader.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/internal/MetadataLoader.java
@@ -37,7 +37,7 @@ import static org.apache.commons.lang.StringUtils.trimToEmpty;
*/
public class MetadataLoader {
- private static final String VERSION_FILE_PATH = "/sonar-api-version.txt";
+ private static final String SQ_VERSION_FILE_PATH = "/sq-version.txt";
private static final String EDITION_FILE_PATH = "/sonar-edition.txt";
private MetadataLoader() {
@@ -45,13 +45,13 @@ public class MetadataLoader {
}
public static Version loadVersion(System2 system) {
- URL url = system.getResource(VERSION_FILE_PATH);
+ URL url = system.getResource(SQ_VERSION_FILE_PATH);
try (Scanner scanner = new Scanner(url.openStream(), StandardCharsets.UTF_8.name())) {
String versionInFile = scanner.nextLine();
return Version.parse(versionInFile);
} catch (IOException e) {
- throw new IllegalStateException("Can not load " + VERSION_FILE_PATH + " from classpath ", e);
+ throw new IllegalStateException("Can not load " + SQ_VERSION_FILE_PATH + " from classpath ", e);
}
}
diff --git a/sonar-plugin-api-impl/src/main/resources/sq-version.txt b/sonar-plugin-api-impl/src/main/resources/sq-version.txt
new file mode 100644
index 00000000000..73f30eb11cf
--- /dev/null
+++ b/sonar-plugin-api-impl/src/main/resources/sq-version.txt
@@ -0,0 +1 @@
+@project.version@
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java
index 046f0bc4bf4..e7f1e23021d 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java
@@ -68,7 +68,7 @@ public class MetadataLoaderTest {
assertThatThrownBy(() -> MetadataLoader.loadVersion(system))
.isInstanceOf(IllegalStateException.class)
- .hasMessageContaining("Can not load /sonar-api-version.txt from classpath");
+ .hasMessageContaining("Can not load /sq-version.txt from classpath");
}
}