我是 Jenkins 的新手,我想使用 Java 创建一个新工作。谁能帮我?
需要使用哪些 API,是否有示例代码?
user3069474
问问题
8251 次
1 回答
1
我正在使用Jenkins REST API
客户端代码 (JAX-WS)
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>
于 2014-01-28T13:01:27.403 回答