diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2022-04-15 10:43:02 -0500 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-04-21 20:02:50 +0000 |
commit | 3b11814268cb11ebcaa7a4c231d2bdb642122518 (patch) | |
tree | f13f6b78fd2b0fd33e6c4dd42c6b3fa618191bc4 /sonar-plugin-api-impl/src | |
parent | b2b5d2819ab9d8bc1804641762d6f397c605a582 (diff) | |
download | sonarqube-3b11814268cb11ebcaa7a4c231d2bdb642122518.tar.gz sonarqube-3b11814268cb11ebcaa7a4c231d2bdb642122518.zip |
SONAR-16232 Fix version metadata
Diffstat (limited to 'sonar-plugin-api-impl/src')
3 files changed, 5 insertions, 4 deletions
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"); } } |