"'资源'不被视为内部或外部命令"在SonarQube 5.1.2中使用Web Service API进行POST时

时间:2016-04-14 12:11:24

标签: sonarqube sonarqube-web

我在Windows 7 Professional上使用SonarQube 5.1.2。我在cURL 7.32.0(x86_64-pc-win32)上使用Web Service API。我想使用POST为特定项目上传sonar.exclusions和更多此类属性。

我使用curl -u admin:admin -X POST http://localhost:9512/api/prop erties/?id=sonar.exclusions -v -T "D:\sonar-exclusions.xml"并且我可以将其作为全局sonar.exclusions发布。

我好像使用resource将命令发布到特定项目 - curl -u admin:admin -X POST http://localhost:9512/api/prop erties/?id=sonar.exclusions&resource=org.myProject:myProject -v -T "D:\sonar-exclusions.xml"我收到错误 {" err_code":200,&# 34; err_msg":"财产创造"}'资源'不被认可为 内部或外部命令,可操作程序或批处理文件

此处resource参数出了什么问题?

1 个答案:

答案 0 :(得分:2)

问题在于URL中的&,它的命令行提示符为:让我运行此命令:

curl -u admin:admin -X POST http://localhost:9512/api/properties/?id=sonar.exclusions

然后运行此命令:

resource=org.myProject:myProject -v -T "D:\sonar-exclusions.xml"

第一个返回{"err_code":200,"err_msg":"property created"},而第二个绑定失败:

'resource' is not recognized as an internal or external command, operable program or batch file

您应该转义&或者只是将网址放在“引号”之间。