如何在 Windows 7 中为声纳(eclipse)创建环境变量 SONAR_RUNNER_HOME

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25897568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:59:15  来源:igfitidea点击:

How to create environment variable SONAR_RUNNER_HOME for sonar (eclipse ) in windows 7

eclipsewindows-7-x64sonarqube

提问by VAibHAv Jain

I am working on eclipse helios and windows 7.

我正在研究 eclipse helios 和 windows 7。

I dont know 1.What needs to be added as a seperator, like ";" , "%" and where? 2. Which directory path of Sonar is to be assigned to the path?

我不知道 1. 需要添加什么作为分隔符,如“;” , "%" 又在哪里?2、Sonar的哪个目录路径要分配给路径?

In short I need whole procedure for setting the SONAR_RUNNER_HOME in windows.

简而言之,我需要在 Windows 中设置 SONAR_RUNNER_HOME 的整个过程。

回答by Rajat Sharma

Steps to set environment variables for SONAR_RUNNER_HOME

为 SONAR_RUNNER_HOME 设置环境变量的步骤

Open your environment variables window. Click new button in System variables section.

打开环境变量窗口。单击系统变量部分中的新建按钮。

  1. Set a variable name SONAR_RUNNER_HOME and its value should be the unzipped path of sonar-runner zip file.

    Example:- variable name:- SONAR_RUNNER_HOME variable value:- C:\Program Files (x86)\sonar-runner

  2. And then append sonar-runner's bin path %SONAR_RUNNER_HOME%\bin to the environment variables path.

    Example:- variable name:- PATH variable value:- %SONAR_RUNNER_HOME%\bin;

  1. 设置变量名 SONAR_RUNNER_HOME ,其值应为 sonar-runner zip 文件的解压路径。

    示例:- 变量名称:- SONAR_RUNNER_HOME 变量值:- C:\Program Files (x86)\sonar-runner

  2. 然后将 sonar-runner 的 bin 路径 %SONAR_RUNNER_HOME%\bin 附加到环境变量路径。

    示例:- 变量名称:- PATH 变量值:- %SONAR_RUNNER_HOME%\bin;

回答by Krummy

You need to open your environment variables first. You do this by pressing "Winkey" + "Pause" at the same time -> click on "advanced system settings" on the left -> select "environment variables"

您需要先打开环境变量。您可以通过同时按“Winkey”+“暂停”来执行此操作-> 单击左侧的“高级系统设置”-> 选择“环境变量”

1.What needs to be added as a seperator, like ";" , "%" and where?

1.需要加什么作为分隔符,如“;” , "%" 又在哪里?

Under Windows ";" (semicolon) is used as seperator. You need to add it at the end of your variable, so you tell windows that another variable begins here. E.g. "C:/programs/myProgram; C:/programs/anotherProgram"(have a look at your "PATH" environment variable and you will understand what I mean.)

在 Windows 下“;” (分号)用作分隔符。您需要将它添加到变量的末尾,以便告诉 windows 另一个变量从这里开始。例如“C:/programs/myProgram; C:/programs/anotherProgram”(看看你的“PATH”环境变量,你就会明白我的意思。)

2. Which directory path of Sonar is to be assigned to the path? In short I need whole procedure for setting the SONAR_RUNNER_HOME in windows.

2、Sonar的哪个目录路径要分配给路径?简而言之,我需要在 Windows 中设置 SONAR_RUNNER_HOME 的整个过程。

The following guide is the same as the offical one on this page Installing and Configuring SonarQube Runner:

以下指南与本页安装和配置 SonarQube Runner上的官方指南相同:

  1. Uncompress the downloaded file into the directory of your choice (e.g.: C:\Program Files\SonarRunner). I'll refer to it as in the next steps.

  2. Update the global settings (database connection, server URL) by editing /conf/sonar-runner.properties. (have a look at the link given above)

  3. Create a new SONAR_RUNNER_HOME environment variable set to

  4. Add the /bin directory to your PATH / Path. (You can either add e.g."C:\Program Files\SonarRunner\bin;" or "%SONAR_RUNNER_HOME%\bin;"). Make sure you add an ";" (semicolon) behind your existing variables as an seperator.

  5. You can check the basic installation by opening a new shell and executing the command "sonar-runner -h" (on Windows platform the command is "sonar-runner.bat -h") . For a example please have a look at the link above.

  1. 将下载的文件解压缩到您选择的目录中(例如:C:\Program Files\SonarRunner)。我将在接下来的步骤中引用它。

  2. 通过编辑 /conf/sonar-runner.properties 更新全局设置(数据库连接、服务器 URL)。(看看上面给出的链接)

  3. 创建一个新的 SONAR_RUNNER_HOME 环境变量设置为

  4. 将 /bin 目录添加到您的 PATH / 路径。(您可以添加例如“C:\Program Files\SonarRunner\bin;”或“%SONAR_RUNNER_HOME%\bin;”)。确保添加“;” (分号)在您现有变量后面作为分隔符。

  5. 您可以通过打开一个新的 shell 并执行命令“sonar-runner -h”(在 Windows 平台上命令是“sonar-runner.bat -h”)来检查基本安装。例如,请查看上面的链接。

You could also have a look at: Analyzing with SonarQube Runner

您还可以查看:使用 SonarQube Runner 进行分析