【问题标题】:SonarQube Scanner - Long pause between plugin downloadsSonarQube Scanner - 插件下载之间的长时间停顿
【发布时间】:2020-10-17 00:35:09
【问题描述】:

Maven 声纳扫描仪需要很长时间来下载插件([INFO] 加载/下载插件(完成)| 时间=495872ms)大约。每次触发构建时需要 9 分钟。此外,缓存不起作用,因为构建是在具有无代理/无服务器架构的云 (Azure DevOps) 上触发的。有什么解决方案可以减少构建速度更快的时间?

[INFO] User cache: /home/vsts/.sonar/cache
[INFO] SonarQube version: 7.9.1
[INFO] Default locale: "en", source code encoding: "UTF-8"
[INFO] Load global settings
[INFO] Load global settings (done) | time=1097ms
[INFO] Server id: #####-$$xxxxx$$$
[INFO] User cache: /home/vsts/.sonar/cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=211ms
[INFO] Load/download plugins (done) | time=495872ms
[INFO] Loaded core extensions: developer-scanner

【问题讨论】:

    标签: java maven azure-devops sonarqube sonarscanner


    【解决方案1】:

    您可以构建一个自托管代理来运行管道。这样插件就可以缓存在本地代理机器上。参考详细步骤here创建自托管代理。

    您还可以手动下载插件 jar 及其依赖项,并将它们包含在代码仓库中。然后,您可以使用脚本任务在管道中手动安装它们以运行以下命令:请参阅here

    mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

    例如:

    mvn install:install-file -Dfile=/plugins/sonar-maven-plugin-3.6.0.1398.jar -DgroupId=org.sonarsource.scanner.maven -DartifactId=sonar-maven-plugin -Dversion=3.6.0.1398 -Dpackaging=jar`
    
    mvn install:install-file -Dfile=/plugins/sonar-scanner-api-2.12.0.1661.jar -DgroupId=org.sonarsource.scanner.api -DartifactId=sonar-scanner-api -Dversion=2.12.0.1661 -Dpackaging=jar
    

    您也可以尝试在 pom 文件中使用 maven-install-plugin 来安装本地 jar。请参阅this thread 了解更多信息。

    【讨论】:

      猜你喜欢
      • 2014-08-15
      • 2012-10-15
      • 2019-05-29
      • 1970-01-01
      • 2012-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多