A Jenkins API Client for Java
Important Note
The Jenkins API Client For Java has now moved under the umbrella of the Jenkins GitHub Organization.
Getting Started
To get started add the following dependency to your project
<dependency>
<groupId>com.offbytwo.jenkins</groupId>
<artifactId>jenkins-client</artifactId>
<version>0.3.6</version>
</dependency>
Starting with a future release 0.4.0 the groupId/artifactId will change (NOT YET DONE!)
<dependency>
NOT YET FINALIZED NOR RELEASED !!!
<groupId>org.jenkins-ci.lib</groupId>
<artifactId>java-client-api</artifactId>
<version>0.4.0</version>
</dependency>
Usage
The com.offbytwo.jenkins.JenkinsServer
class provides the main entry point into the API. You can create a reference to the Jenkins server given its location and (optionally) a username and password/token.
JenkinsServer jenkins = new JenkinsServer(new URI("http://localhost:8080/jenkins"), "admin", "password")
At the top level you can access all of the currently defined jobs. This returns a map of job names (in lower case) to jobs.
Map<String, Job> jobs = jenkins.getJobs()
The Job class provides only summary information (name and url). You can retrieve details as follows
JobWithDetails job = jobs.get("My Job").details()
The JobWithDetails
class provides you with access to the list of builds (and related information such as the first, last, successful, etc) and upstream and downstream projects.
Running Tests
To run only unit tests without invoking the integration tests use the following command:
mvn clean install -DskipITs
Running Integration Tests
To run integration tests simply start
mvn -Prun-its clean verify
There is also a separate project which contains integration tests which are running with a special version of Jenkins within a Docker container to check several aspects of the API which can't be covered by the usual integration tests.
Release Notes
You can find details about the different releases in the Release Notes.
- Release 0.3.7.
- Release 0.3.6.
- Release 0.3.5.
- Release 0.3.4.
- Release 0.3.3.
- Release 0.3.2.
- Release 0.3.1.
Contribution
Creating Issues
If you find a problem please create an issue in the ticket system with the component java-client-api
and describe what is going wrong or what you expect to happen. If you have a full working example or a log file this is also helpful. You should of course describe only a single issue in a single ticket and not mixing up several different things into a single issue.
Creating a Pull Request
Before you create a pull request it is necessary to create an issue in the ticket system before with the component java-client-api
and describe what the problem is or what kind of feature you would like to add. Afterwards you can create an appropriate pull request.
It is required if you want to get a Pull request to be integrated into please squash your commits into a single commit which references the issue in the commit message which looks like this:
Fixed #Issue
o Description.
This makes it simpler to merge it and this will also close the appropriate issue automatically in one go. This make the life as maintainer a little bit easier.
A pull request has to fulfill only a single ticket and should never create/add/fix several issues in one, cause otherwise the history is hard to read and to understand and makes the maintenance of the issues and pull request hard or to be honest impossible.
Furthermore it is neccesary to create appropriate entries into the ReleaseNotes.md
file as well.
Help & Questions
You can ask questions in the mailing list which is also intended as discussion forum for development.
Generated Site
http://jenkinsci.github.io/java-client-api/
https://github.com/xiaomin0322/java-client-api
相关推荐
压缩包中的`jenkinsApi`文件可能包含一个简单的Java示例,展示了如何初始化Jenkins客户端、设置认证、触发Job构建等基本操作。通过分析这个示例,可以更好地理解上述知识点的实际应用。 在实际项目中,使用Java...
Java的Jenkins API客户端 重要的提示 Java的Jenkins API客户端现已移至Jenkins GitHub Organization的保护下。 什么是“ Java的詹金斯API客户端”? 该库只是使用jenkins的REST API的一段Java代码。 这意味着您可以...
Java Jenkins Web Service Client是用于与Jenkins CI服务器交互的一种客户端工具,它允许开发者通过编程方式执行Jenkins的各种操作,如创建、更新、删除Job等。这个客户端基于Java编写,能够方便地集成到Java项目中...
詹金斯·雷斯特Java客户端建立在jclouds的顶部,可与Jenkins REST API一起使用。建立客户可以这样构建: JenkinsClient client = JenkinsClient.builder().endPoint("http://127.0.0.1:8080") // Optional. Defaults...
使用 Java 操作 Jenkins 操作凭证信息可以通过使用 Jenkins-client 库来实现。Jenkins-client 库提供了一些方法来操作 Jenkins 服务器中的凭证信息,例如创建、更新和删除凭证信息等。 首先,需要添加 Jenkins-...
1. **安装 Java**:Jenkins 需要 Java 运行环境,确保系统已安装最新版的 JDK。 2. **下载 Jenkins**:从官方网站获取适合 Linux 平台的 Jenkins 可执行文件。 3. **启动 Jenkins**:通过命令行启动 Jenkins,例如...
Apache HttpComponents Client 4.x API Plugin Bootstrap 4 API Plugin Bootstrap 5 API bouncycastle API Branch API Build Timeout Caffeine API Plugin Checks API plugin Command Agent Launcher Plugin ...
《Nomad Client Java API 客户端详解》 在当今的云计算环境中,Nomad是一个流行的分布式系统调度器,由HashiCorp公司开发。Nomad以其简单、高效和可扩展的特性,广泛应用于微服务架构和容器编排。而Nomad Client ...
- **构建后操作**: 选择`Deploy war/ear to a container`,以部署到Tomcat容器中。 **注意事项**: - **坑1**: 确保Git配置正确,尤其是指向`.exe`文件。 - **坑2**: 必须先安装Git插件才能在源码管理中选择Git。 -...
6. **git-client**: Git 客户端插件是Jenkins与Git版本控制系统交互的基础,提供拉取、推送、分支管理等功能。 7. **GiteeWebHook**: GiteeWebHook 插件使得Jenkins能够接收来自Gitee(中国的一个Git服务提供商)的...
首先,我们需要了解Jenkins的Java客户端API,它是用来与Jenkins服务器通信的库。在提供的压缩包文件`java-client-api-master`中,很可能包含了这个客户端API的源代码或构建后的jar文件。为了远程调用Jenkins,你需要...
Swarm客户端是一个轻量级的Java应用程序,它可以连接到Jenkins Master并声明自己为可用的构建资源。通过使用Swarm客户端,你可以动态地添加、删除和管理Jenkins节点,以适应不断变化的工作负载需求。 Fabric8的...
7. **Apache HTTP Components Client 4 API插件**: 提供对HTTP协议的支持,用于Jenkins与其他服务的通信,比如从远程服务器拉取资源或推送构建结果。 8. **Jackson2 API插件**: Jackson是一个流行的数据绑定库,...
- 插件文件包括:`scm-api.hpi`、`git-client.hpi`、`git.hpi`和`git-parameter.hpi`。 - 注意安装顺序,以确保插件之间的依赖关系得到满足。 3. **系统设置**: - 进入“系统管理”->“系统设置”页面。 - ...
Git Client 插件为 Jenkins 提供 Git 操作的底层支持,而 Git 插件则提供了更高层次的 Git 功能,如创建分支、合并、拉取请求等,方便在 Jenkins 中集成 Git 工作流。 6. **bouncycastle-api.jpi**: Bouncy Castle ...
vSphere Client SDK 6.7 支持自动化流程,开发者可以通过 API 实现与 CI/CD 工具(如 Jenkins、GitLab CI/CD)的集成,自动化执行部署、更新、测试等任务,提升 DevOps 效率。 总之,vSphere Client SDK 6.7 是一...
OpenShift Pipeline DSL插件是Jenkins插件,旨在提供可读,简洁,全面且流利的Jenkins Pipeline语法,以实现与OpenShift API服务器的丰富交互。 该插件利用了OpenShift命令行工具(oc),该脚本必须在执行脚
在"Selenium-java-2.35.0"这个版本中,Java开发者可以利用提供的API来创建测试脚本,这些API包括了用于导航、元素操作、等待策略、异常处理等的各种方法。例如,`WebDriver`接口是所有WebDriver实现的基础,而`...