我最近在我的 Linux 机器( x86_64 x86_64 x86_64 GNU/Linux )上安装了 Sonarqube-4.5.1。
我可以使用
./sonar.sh start
命令启动声纳。使用 ./sonar.sh status
命令检查声纳状态时,它会显示 SonarQube is running (18493)
,但是当我尝试打开仪表板 url http://ip-address:9000
时,它会在浏览器上显示“连接被拒绝”消息。运行
mvn sonar:sonar -Dsonar.host.url=http://localhost:9000
命令时,我收到以下错误:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project app-dao: Execution default-cli of goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar failed: SonarQube server can not be reached at http://localhost:9000. Please check the parameter 'sonar.host.url'. Connection refused -> [Help 1]
我还尝试了maven连接到Sonar提到的解决方案,并在我的maven的conf/settings.xml文件中添加了以下条目,但仍然无法解决问题。
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- EXAMPLE FOR MYSQL -->
<sonar.jdbc.username>admin</sonar.jdbc.username>
<sonar.jdbc.password>admin</sonar.jdbc.password>
<sonar.host.url>http://localhost:9000</sonar.host.url>
</properties>
</profile>
今天早上刚遇到这个问题。通过配置服务器访问 MySQL 数据库解决了这个问题:http://docs.codehaus.org/display/SONAR/Installing
您想要编辑 {sonar_home}/conf/sonar.properties 并取消注释 url、用户名和密码。
如果您愿意,您可能必须添加新的数据库用户。
您必须先启动 Sonar 服务器。
转到
\sonar-3.5.1\bin\windows-x86-32
并双击 StartSonar.bat
在安装目录sonar.properties文件的conf文件夹中,有一个属性sobar.web.host。如果您明确定义了 IP,则可能会导致此问题。注释掉并重新启动服务器。这对我有用。