Custom Plugins: APIs and Javadocs of CloudBees Jenkins Enterprise plugins

Article ID:228175367
1 minute readKnowledge base

Issue

  • You may wish to create custom plugins depending (pom.xml) on CloudBees Jenkins Enterprise plugins

  • You may wish to call APIs in CloudBees Jenkins Enterprise plugins from custom Groovy scripts and want details on these APIs

Environment

  • CloudBees Jenkins Enterprise

  • Enterprise plugins

Resolution

Explicit dependency is not recommended unless you have a real use-case for it because:

  • CloudBees does not guarantee binary compatibility

  • It makes migration path more complex

Having said that, for this scenario you can make use of the dev-connect Maven repository https://repo.cloudbees.com/content/repositories/dev-connect/.

If you end up including this type of dependency, the following disclaimer should be added to the custom plugin:

 - Backward compatibility of API and behavior is not guaranteed for this plugin
 - Testing may be complicated, because CloudBees proprietary plugins perform license checks

How to use it?

Let’s take as sample the operations-center-context plugin 2.60.0.4. Its coordinates can be found from https://docs.cloudbees.com/docs/release-notes/latest/plugins/operations-center-context-plugin :

  • Group Id: com.cloudbees.operations-center.common

  • Artifact Id: operations-center-context

  • Type: hpi

  • Version: 2.60.0.4

Dev Connect is a blind/proxy repository thus it cannot be browsed if no one used the artifact before.

How to download ?

If you are using Apache Maven you can download the plugin (and its dependencies) with:

mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.1:get -Dartifact=com.cloudbees.operations-center.common:operations-center-context:2.60.0.4:hpi -DremoteRepositories=cloudbees::default::https://repo.cloudbees.com/content/repositories/dev-connect/

And its jar (if you want the autocompletion in an IDE) with:

mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.1:get -Dartifact=com.cloudbees.operations-center.common:operations-center-context:2.60.0.4:jar -DremoteRepositories=cloudbees::default::https://repo.cloudbees.com/content/repositories/dev-connect/ -Dtransitive=false

And for the javadoc you will use:

mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.1:get -Dartifact=com.cloudbees.operations-center.common:operations-center-context:2.60.0.4:jar:javadoc -DremoteRepositories=cloudbees::default::https://repo.cloudbees.com/content/repositories/dev-connect/ -Dtransitive=false

You’ll find locally all these artifacts in your local repository under ${HOME}/.m2/repository/com/cloudbees/operations-center/common/operations-center-context/2.60.0.4/

You can also do all of this by creating an Apache Maven pom.xml file with these artifacts as dependencies.

<dependency> <groupId>com.cloudbees.operations-center.common</groupId> <artifactId>operations-center-context</artifactId> <version>2.60.0.4</version> <!-- <type>hpi</type> --> <!-- <classifier>javadoc</classifier> --> </dependency>