sonar maven plugin build error, SonarQube version: null

前端 未结 6 1579
你的背包
你的背包 2021-01-05 12:48

My jenkins builds just started to fail with this message:

[INFO] --- sonar-maven-plugin:2.7:sonar (default-cli) @ cividas-core-web ---
[INFO] artifact com.on         


        
6条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-05 13:34

    For those interested in "why?", I've done some more digging and what seems to be happening is this:

    • RunnerBootstrapper attempts to check whether a version is 5.2+:

    • First, serverVersion is retrieved from a launcher created in EmbeddedRunner,

    • using IsolatedLauncher creating a proxy of implementation class BatchIsolatedLauncher

    • which attempts to read a resource file sq-version.txt containing the version.

    This sq-version.txt file is located in org.codehaus.sonar:sonar-plugin-api, but this dependency is not included (even transitively) in the sonar-maven-plugin. All it references sonar-wise is org.sonarsource.sonar-runner:sonar-runner-api.

    They seem to have changed the location and name of the version txt file but not updated all code. You might get away with manually adding an sq-version.txt with content 5.2 (no newline) to the plugin classpath (possibly by updating the plugin jar), or add a dependency on sonar-plugin-api, but these are hacks.

    The sonar-maven-plugin 2.6 uses sonar-runner 2.4, which is very different from 2.5 that sonar-maven-plugin 2.7 uses (the groupId for sonar-runner has changed domains from org.codehaus.sonar.runner to org.sonarsource.sonar-runner), so it's best to stick to the v2.6 plugin until they have smoothed out the transition and released a few more versions.

提交回复
热议问题