我是Jenkins的新手,我想用Java创建一份新工作。任何人都可以帮助我吗? 有哪些API需要使用,是否有示例代码?
答案 0 :(得分:1)
我正在使用Jenkins REST API
Response result = ClientBuilder.newClient()
.target("http://myserver/jenkins")
.path("createItem")
.queryParam("name", "myNewJob")
.request()
.accept(MediaType.APPLICATION_JSON)
.post(Entity.entity(jobConfigurationXml(),
MediaType.APPLICATION_XML));
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
</project>