# Converting Jenkins plugin to build with Gradle: how do I deploy?

**URL:** <https://discuss.gradle.org/t/converting-jenkins-plugin-to-build-with-gradle-how-do-i-deploy/18813>\
**Category:** Help/Discuss\
**Created:** [August 4, 2016, 8:31am UTC](https://discuss.gradle.org/t/converting-jenkins-plugin-to-build-with-gradle-how-do-i-deploy/18813 "2016-08-04T08:31:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodrigc](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rodrigc/32/5302_2.png) [@rodrigc](https://discuss.gradle.org/u/rodrigc)\
**Post date:** [August 4, 2016, 8:31am UTC](https://discuss.gradle.org/t/converting-jenkins-plugin-to-build-with-gradle-how-do-i-deploy/18813/1 "2016-08-04T08:31:00Z")

</div>

I am converting the Jenkins Build Flow plugin to build with Gradle using the gradle-jpi-plugin.  
My handiwork is here:

> **[jenkinsci/build-flow-plugin](https://github.com/jenkinsci/build-flow-plugin)**
>
> build-flow-plugin - A plugin to manage job orchestration

In that repository, I have a build.gradle file, and I am able to successfully build and run all the tests.  
Yay!

Now for the last step, in migrating away from maven, I would like to replicate the deployment  
step that Jenkins plugins use. Currently, the Jenkins maven-hpi-plugin offers two targets for preparing the deployment and actually doing the deployment: [https://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins#HostingPlugins-Releasingtojenkinsci.org](https://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins#HostingPlugins-Releasingtojenkinsci.org)

**mvn release:prepare**  
**mvn release:perform**

This is what it looks like when I type those commands.  
If I type:

**mvn release:prepare**

I get these prompts:

```gradle
What is the release version for "Build Flow plugin"? (com.cloudbees.plugins:build-flow-plugin) 0.20: : 
What is SCM release tag or label for "Build Flow plugin"? (com.cloudbees.plugins:build-flow-plugin) build-flow-plugin-0.20: : 
What is the new development version for "Build Flow plugin"? (com.cloudbees.plugins:build-flow-plugin) 0.21-SNAPSHOT: : 

```

Maven then creates the git tags for the release, and performs the build and test.  
It also updates the POM file with the next snapshot version. It does all the necessary git commands:

```gradle
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git add -- pom.xml
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git status --porcelain
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git commit --verbose -F /var/folders/m0/xq5mbjy11b175l99w_1d_5ww0000gn/T/maven-scm-1204261108.commit pom.xmlry: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git symbolic-ref HEAD
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git push https://github.com/jenkinsci/build-flow-plugin.git master:master
[INFO] Working directory: /Users/crodrigues/build-flow-pluginplugin && git tag -F /var/folders/m0/xq5mbjy11b175l99w_1d_5ww0000gn/T/maven-scm-339689584.commit[INFO] Tagging release with the label build-flow-plugin-0.20...
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git tag -F /var/folders/m0/xq5mbjy11b175l99w_1d_5ww0000gn/T/maven-scm-339689584.commit build-flow-plugin-0.20
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git push https://github.com/jenkinsci/build-flow-plugin.git build-flow-plugin-0.20
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git ls-files
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Transforming 'Build Flow plugin'...
[INFO] Not removing release POMs
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git add -- pom.xml
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git status --porcelain
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git commit --verbose -F /var/folders/m0/xq5mbjy11b175l99w_1d_5ww0000gn/T/maven-scm-279236174.commit pom.xml
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git symbolic-ref HEAD
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Executing: /bin/sh -c cd /Users/crodrigues/build-flow-plugin && git push https://github.com/jenkinsci/build-flow-plugin.git master:master
[INFO] Working directory: /Users/crodrigues/build-flow-plugin
[INFO] Release preparation complete.
[INFO] ------------------------------------------------------------------------

```

If I type:

**mvn release:perform**

Maven then deploys the built items to [http://maven.jenkins-ci.org:8081/content/repositories/releases](http://maven.jenkins-ci.org:8081/content/repositories/releases)

Currently, the gradle-jpi-plugin does not offer this functionality, requiring the user to manually  
git tag. Is there a plugin in the gradle ecosystem that can do these steps?  
If so, I can more easily migrate Jenkins plugin development to Jenkins

Thanks!

---

<div class="post-metadata">

**Author:** ![Lance\_Java](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance_java/32/787_2.png) [@Lance\_Java](https://discuss.gradle.org/u/Lance_Java)\
**Post date:** [August 4, 2016, 11:01pm UTC](https://discuss.gradle.org/t/converting-jenkins-plugin-to-build-with-gradle-how-do-i-deploy/18813/2 "2016-08-04T23:01:39Z")

</div>

There’s grgit

> **[ajoberstar/grgit](https://github.com/ajoberstar/grgit)**
>
> grgit - The Groovy way to use Git.

Which is a fluent groovy wrapper around jgit

> **[JGit](https://eclipse.org/jgit/)**
>
> Eclipse is probably best known as a Java IDE, but it is more: it is an IDE framework, a tools framework, an open source project, a community, an eco-system, and a foundation.

There’s also a gradle plugin

> **[ajoberstar/gradle-git](https://github.com/ajoberstar/gradle-git)**
>
> gradle-git - Git plugin for Gradle

If it were me, I’d probably choose jgit to reduce dependencies

---

<div class="post-metadata">

**Author:** ![rodrigc](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rodrigc/32/5302_2.png) [@rodrigc](https://discuss.gradle.org/u/rodrigc)\
**Post date:** [August 9, 2016, 8:32pm UTC](https://discuss.gradle.org/t/converting-jenkins-plugin-to-build-with-gradle-how-do-i-deploy/18813/3 "2016-08-09T20:32:30Z")

</div>

@Lance_Java thanks for the response. Based on your reply, I looked at:

> **[ajoberstar/gradle-git](https://github.com/ajoberstar/gradle-git/wiki/Release-Plugins)**
>
> gradle-git - Git plugin for Gradle

From that link, several plugins which have “maven release” like behavior are listed:

- [townsfolk/gradle-release](https://github.com/townsfolk/gradle-release)
- [ari/gradle-release-plugin](https://github.com/ari/gradle-release-plugin)
- [stianh/gradle-release-plugin](https://github.com/stianh/gradle-release-plugin)
- [netzwerg/gradle-release-plugin](https://github.com/netzwerg/gradle-release-plugin)

I also found [researchgate/gradle-release](https://github.com/researchgate/gradle-release)

That’s a lot to choose from! Do you have any experience with these plugins?

I also found this post: [What is the equivalent to the maven release plugin in gradle?](https://discuss.gradle.org/t/what-is-the-equivalent-to-the-maven-release-plugin-in-gradle/6827/6) which mentions some of the same plugins.
