使用MSBuild.SonarQube.Runner.exe从命令行进行分析的前两个阶段(准备,构建)似乎工作正常。
SonarQube.Analysis.xml中的属性为:
<Property Name="sonar.host.url">http://server-45:9000</Property>
<Property Name="sonar.login">admin</Property>
<Property Name="sonar.password">admin</Property>
<Property Name="sonar.jdbc.url">jdbc:jtds:sqlserver://server-46/SonarQube;instance=INSTANCE01;SelectMethod=Cursor</Property>
<Property Name="sonar.jdbc.driverClassName">com.microsoft.sqlserver.jdbc.SQLServerDriver</Property>
<Property Name="sonar.jdbc.username">sonarqube</Property>
<Property Name="sonar.jdbc.password">stackoverflow</Property>
最后阶段失败了:
17:30:17.358 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
它似乎完全忽略了本地xml设置文件,找到了exe 相同的默认值,并且仍在尝试创建与数据库的默认h2连接。
完整日志:
C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9>MSBuild.SonarQube.Runner end
Default properties file was found at C:\Apps\MsSonarRunner\SonarQube.Analysis.xml
Loading analysis properties from C:\Apps\MsSonarRunner\SonarQube.Analysis.xml
Post-processing started.
WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:\Users\me\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\ClassLibrary9\ClassLibrary9.csproj
The SONAR_RUNNER_HOME environment variable is not required and will be ignored.
SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the sonar-runner...
C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\.sonarqube\bin\sonar-runner\bin\..
SonarQube Runner 2.4
Java 1.8.0_60 Oracle Corporation (64-bit)
Windows 8 6.2 amd64
SONAR_RUNNER_OPTS=-Xmx1024m
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\.sonarqube\bin\sonar-runner\bin\..\conf\sonar-runner.properties
INFO: Project configuration file: C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\.sonarqube\out\sonar-project.properties
INFO: Default locale: "en_GB", source code encoding: "UTF-8"
INFO: Work directory: C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\.sonarqube\out\.sonar
INFO: SonarQube Server 5.1.2
17:30:17.096 INFO - Load global repositories
17:30:17.295 INFO - Load global repositories (done) | time=200ms
17:30:17.296 INFO - Server id: 20151005162012
17:30:17.298 INFO - User cache: C:\Users\me\.sonar\cache
17:30:17.304 INFO - Install plugins
17:30:17.350 INFO - Install JDBC driver
17:30:17.358 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.817s
Final Memory: 8M/245M
INFO: ------------------------------------------------------------------------
17:30:17.415 Creating a summary markdown file...
这里有任何想法吗?
提前致谢。
答案 0 :(得分:0)
Fixed.
This was a side effect of the following:
I copied batch files from another analysis over and the /s switch pointed to a completely different settings xml file. Doing the pre build run and the post build run with 2 different sets of settings causes this confusion.