我有Sonar 3.7.x的规则集备份,想要导入Sonar 5.2。此规则集具有PMD,CheckStyle和Findbugs的规则。当我尝试通过GUI时,导入工作没有任何错误,但没有导入规则(0规则)。然后我尝试使用Sonl API使用curl导入规则集。这里命令也成功了,尽管结果(ruleFailures:600)表明XML中没有导出600中的规则(与GUI相同的行为)。
-bash-4.1$ curl -X POST -u admin:admin -F "backup=@My_standard_java_600.xml" -v http://XX.XX.40.70:9080/api/profiles/restore
* About to connect() to XX.XX.40.70 port 9080 (#0)
* Trying XX.XX.40.70... connected
* Connected to XX.XX.40.70 (XX.XX.40.70) port 9080 (#0)
* Server auth using Basic with user 'admin'
> POST /api/profiles/restore HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: XX.XX.40.70:9080
> Accept: */*
> Content-Length: 105883
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------b413fb6533eb
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Set-Cookie: JSESSIONID=CE9FC5FE32939BE5ECC4FC64324B238D; Path=/; HttpOnly
< X-Runtime: 16162
< ETag: "c48a79cd01c8066aa814d5755e0c29ed"
< Cache-Control: private, max-age=0, must-revalidate
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Content-Type: application/json;charset=utf-8
< Content-Length: 194
< Date: Wed, 02 Dec 2015 15:16:15 GMT
<
* Connection #0 to host XX.XX.40.70 left intact
* Closing connection #0
{"profile":{"key":"java-my-standard-63451","name":"My Standard","language":"java","isDefault":false,"isInherited":false,"languageName":"Java"},"ruleSuccesses":0,"ruleFailures":600}
我将Sonar-way Java规则导出与我的文件进行了比较,但我发现XML格式可能已从v3.x更改为5.x.任何声纳专家都能帮忙解决这个问题吗?
答案 0 :(得分:1)
正如G.Ann上面的评论所指出的,这个问题与新的Sonar 5.2安装中缺少Findbugs,Checkstyle和PMD插件有关,因为它们不再支持开箱即用,而是支持Squid。一旦安装完成导入工作,虽然在Sonar的一部分有点恼人,没有暗示不导入规则的真正原因。