jenkins 版本 1.6.10
不多说,如果你还没搞定这个接口,请运行下面的代码,帮你创建一个 jenkins 任务
@Test
public void post_xml() throws IOException {
String server = "127.0.0.1:8080" ;
String jenkinsHost = "http://"+server+"/" ;
String projectName = "TEST44" ;
String configurationFile = "D:\\workspace\\Qone\\target\\classes\\jobTemplate\\demo.xml";
String username = "xxxxxxxx";
String apiToken = "xxxxxxxxxxxxxxxxxxxxxxxx" ;
HttpClient client = new HttpClient();
client.getState().setCredentials(
new AuthScope(server,443,"realm"),
new UsernamePasswordCredentials(username,apiToken)
);
client.getParams().setAuthenticationPreemptive(true);
PostMethod post = new PostMethod(jenkinsHost+"/createItem?name="+pro