gpt4 book ai didi

sonarqube - 具有环境变量的 Sonar 属性

转载 作者:行者123 更新时间:2023-12-03 07:30:57 24 4
gpt4 key购买 nike

我们可以引用sonar-project.properties中的环境变量吗? ?例如:

sonar.libraries=${env:WL_HOME}/server/lib/weblogic.jar

环境变量很有用,因为不同机器和操作系统的库依赖位置可能不同。

当我用Sonar Runner分析我的项目时,我遇到了下面的错误。
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: Unable to resolve path "${env:WL_HOME}/server/lib"
at org.sonar.batch.scan.ProjectReactorBuilder.resolvePath(ProjectReactorBuilder.java:463)
at org.sonar.batch.scan.ProjectReactorBuilder.getLibraries(ProjectReactorBuilder.java:449)
at org.sonar.batch.scan.ProjectReactorBuilder.validateDirectories(ProjectReactorBuilder.java:299)
at org.sonar.batch.scan.ProjectReactorBuilder.defineProject(ProjectReactorBuilder.java:131)
at org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:114)
at org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:95)
at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:72)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:56)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:44)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:175)
at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:163)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Caused by: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:414)
at java.io.File.getCanonicalPath(File.java:618)
at java.io.File.getCanonicalFile(File.java:643)
at org.sonar.batch.scan.ProjectReactorBuilder.resolvePath(ProjectReactorBuilder.java:461)
... 34 more

我的环境:
  • SonarQube 4.3.2
  • SonarQube Runner 2.4
  • jdk1.7.0_65
  • Windows 7 专业版 32 位
  • 最佳答案

    Sonar-project.properties 中的环境变量支持已添加到 SonarQube Scanner CLI 2.9,参见 SQSCANNER-9 .

    环境变量必须以前缀 env. 开头不是 env:
    将 SonarQube 升级到 2.9+ 并将您的属性更新为正确的语法后,它应该正确分析您的项目。正确使用环境变量的示例:

    sonar.libraries=${env.WL_HOME}/server/lib/weblogic.jar 

    关于sonarqube - 具有环境变量的 Sonar 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24878087/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com