Jenkins API client for Java :: The Client.

A Jenkins API client for Java

License

License

Categories

Categories

Jenkins Build Tools Continuous Integration and Continuous Delivery CLI User Interface
GroupId

GroupId

com.offbytwo.jenkins
ArtifactId

ArtifactId

jenkins-client
Last Version

Last Version

0.3.8
Release Date

Release Date

Type

Type

jar
Description

Description

Jenkins API client for Java :: The Client.
A Jenkins API client for Java

Download jenkins-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.offbytwo.jenkins/jenkins-client/ -->
<dependency>
    <groupId>com.offbytwo.jenkins</groupId>
    <artifactId>jenkins-client</artifactId>
    <version>0.3.8</version>
</dependency>
// https://jarcasting.com/artifacts/com.offbytwo.jenkins/jenkins-client/
implementation 'com.offbytwo.jenkins:jenkins-client:0.3.8'
// https://jarcasting.com/artifacts/com.offbytwo.jenkins/jenkins-client/
implementation ("com.offbytwo.jenkins:jenkins-client:0.3.8")
'com.offbytwo.jenkins:jenkins-client:jar:0.3.8'
<dependency org="com.offbytwo.jenkins" name="jenkins-client" rev="0.3.8">
  <artifact name="jenkins-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.offbytwo.jenkins', module='jenkins-client', version='0.3.8')
)
libraryDependencies += "com.offbytwo.jenkins" % "jenkins-client" % "0.3.8"
[com.offbytwo.jenkins/jenkins-client "0.3.8"]

Dependencies

compile (14)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-annotations jar 2.3.4
com.fasterxml.jackson.core : jackson-core jar 2.3.4
com.fasterxml.jackson.core : jackson-databind jar 2.3.4
dom4j : dom4j jar 1.6.1
net.sf.json-lib : json-lib jar 2.4
com.google.guava : guava jar 17.0
commons-lang : commons-lang jar 2.6
commons-io : commons-io jar 2.4
org.apache.httpcomponents : httpclient jar 4.3.6
org.apache.httpcomponents : httpcore jar 4.3.3
org.apache.httpcomponents : httpmime jar 4.3.6
jaxen : jaxen jar 1.1.6
org.slf4j : slf4j-api jar 1.7.21
xml-apis : xml-apis jar 1.4.01

test (5)

Group / Artifact Type Version
org.jvnet.hudson : xstream jar 1.4.7-jenkins-1
junit : junit jar 4.11
org.mockito : mockito-core jar 1.9.5
org.jenkins-ci.main » jenkins-test-harness jar 1.644
org.assertj : assertj-core jar 1.7.1

Project Modules

There are no modules declared in this project.

A Jenkins API Client for Java

MIT Licence Maven Central Build Status Javadocs

Important Note

The Jenkins API Client For Java has now moved under the umbrella of the Jenkins GitHub Organization.

What is the "Jenkins API Client for Java"?

This library is just a piece of java code which uses the REST API of jenkins. This means you can trigger builds, extract informations about jobs or builds etc. The information you can extract will be represented in java objects which you can reuse for other purposes or integrate this library into other parts for a higher level of integration.

Getting Started

If you like to use this library you need to add the library as a dependency to your project. This can be done by using a Maven dependency like the following:

<dependency>
  <groupId>com.offbytwo.jenkins</groupId>
  <artifactId>jenkins-client</artifactId>
  <version>0.3.8</version>
</dependency>

This can also being done by defining a Gradle dependency like this:

compile 'com.offbytwo.jenkins:jenkins-client:0.3.8'

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 module 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.

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 necessary 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/

License

Copyright (C) 2013, Cosmin Stejerean, Karl Heinz Marbaise, and contributors.

Distributed under the MIT license: http://opensource.org/licenses/MIT

com.offbytwo.jenkins

Jenkins

Jenkins is an open source automation server with an unparalleled plugin ecosystem to support practically every tool as part of your delivery pipelines

Versions

Version
0.3.8
0.3.7
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.0
0.1.5
0.1.4