我正在使用 jenkins api xml 创建新工作,查看工作,构建......它仅在 jenkins 不安全时才有效我正在使用此代码创建新工作
PostMethod postMethod = new PostMethod("localhost:8080/createItem?name="+projectName);
postMethod.setRequestHeader("Content-type","application/xml; charset=ISO-8859-1");
postMethod.setRequestBody(new FileInputStream(new File("/resources/config.xml")));
HttpClient client = new HttpClient();
returnCode = client.executeMethod(postMethod);