-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
JAVA 7, jdk7, Eclispe Luna, Jenkins 1.6
I want to create a job from my java project, after I want the builder and gets the console.
Now I created the project using REST API jenkins : "http://localhost:8080/createItem?name=${ProjectName}" , and I have not found how to create or generate the java file config.xml.
here is my code:
public class CreateJob {
public void CreateItem(String nomProjet) throws FileNotFoundException {
String strURL = "http://localhost:8083/createItem?name=${nomProjet}";
File input = new File("D:/config.xml");
PostMethod post = new PostMethod(strURL);
post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(input), input.length()));
post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
HttpClient httpclient = new HttpClient();
try
{ int result = httpclient.executeMethod(post); System.out.println("Response status code: " + result); System.out.println("Response body: "); System.out.println(post.getResponseBodyAsString()); }catch (Exception e)
{ // Release current connection to the connection pool // once you are done post.releaseConnection(); }