{"id":3048,"date":"2017-04-13T08:04:25","date_gmt":"2017-04-13T15:04:25","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=3048"},"modified":"2023-09-07T04:45:33","modified_gmt":"2023-09-07T11:45:33","slug":"create-a-continuous-deployment-pipeline-with-jenkins-and-java","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/","title":{"rendered":"Create a Continuous Deployment Pipeline with Jenkins and Java"},"content":{"rendered":"<p>Lately I&#8217;ve been working a lot with Jenkins <span style=\"font-weight: 400\">to run Java JAR files <\/span>for continuous deployment of one of my applications. \u00a0In case you haven&#8217;t seen it, the keynote demonstration given at <a href=\"https:\/\/youtu.be\/Bq8zkcbnRac?t=26m25s\" target=\"_blank\" rel=\"noopener noreferrer\">Couchbase Connect 2016<\/a> used Jenkins to build and redeploy the Java backend and Angular frontend every time a change was detected on GitHub. \u00a0This is the application I helped build.<\/p>\n<p>So how did I leverage <a href=\"https:\/\/jenkins.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jenkins<\/a> <span style=\"font-weight: 400\">deploy this Java application<\/span>? \u00a0We&#8217;re going to see how to create <span style=\"font-weight: 400\">a JAR file using Jenkins, resulting in <\/span>a continuous deployment pipeline that includes building and deploying to a server.<\/p>\n<p><!--more--><\/p>\n<p>To be clear, I won&#8217;t be explaining how to use the Couchbase Connect 2016 application, which I&#8217;m calling <a href=\"https:\/\/github.com\/couchbaselabs\/gittalent\" target=\"_blank\" rel=\"noopener noreferrer\">GitTalent<\/a>, with Jenkins as it is a bit more complicated. \u00a0We&#8217;re going to start slow to get a better understanding.<\/p>\n<h2>The Requirements<\/h2>\n<p>There are a few requirements that need to be met in order to be successful with this guide. \u00a0They can be found below:<\/p>\n<ul>\n<li>JDK 8<\/li>\n<li><a href=\"https:\/\/jenkins.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jenkins<\/a> 2.32+<\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/downloads\/\" target=\"_blank\" rel=\"noopener noreferrer\">Couchbase Server<\/a> 4.6+<\/li>\n<\/ul>\n<p>In this example, Jenkins, the JDK, and Couchbase Server will all reside on the same machine. This means that a Jenkins continuous deployment script will pull code from GitHub, build it using the JDK, and publish it locally rather than to some remote server. That said, some of the automation is removed from this example because to get Jenkins to automatically build when commits are found, GitHub hooks require a machine that is not localhost. \u00a0The effectiveness of this guide will still be present.<\/p>\n<p>While Couchbase is a requirement, it is not the focus of this guide. \u00a0It needs to be present for the sample application that we&#8217;ll be pulling off GitHub.<\/p>\n<h2>Configuring Jenkins with the Required Plugins and Dependencies<\/h2>\n<p>At this point you should have at least downloaded Jenkins. \u00a0We&#8217;re going to walk through setting it up because it can be a little confusing for a first time user.<\/p>\n<p>You can run Jenkins by executing the following from the Command Prompt or Terminal:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">java -jar jenkins.war -httpPort=8080<\/pre>\n<p>The above command will make Jenkins accessible at <strong>https:\/\/localhost:8080<\/strong> in your web browser. \u00a0Upon first launch you&#8217;ll be guided through a wizard for configuration.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3058 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-config-1.png\" alt=\"Jenkins Configuration Part 1\" width=\"1100\" height=\"522\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-1.png 1100w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-1-300x142.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-1-1024x486.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-1-768x364.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-1-20x9.png 20w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>As part of the first configuration step, you&#8217;ll need to obtain a generated value to be used as the super admin password.<\/p>\n<p>After providing the password as per the instructions on the screen, you&#8217;ll be asked about the installation of Jenkins plugins.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3059 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-config-2.png\" alt=\"Jenkins Configuration Part 2\" width=\"1100\" height=\"521\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-2.png 1100w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-2-300x142.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-2-1024x485.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-2-768x364.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-2-20x9.png 20w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>We&#8217;re going to start by installing the suggested plugins and then install extras later. \u00a0It may take some time, but after the suggested plugins have been installed you&#8217;ll be prompted to set up your first administrative user account.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3060 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-config-3.png\" alt=\"Jenkins Configuration Part 3\" width=\"1100\" height=\"520\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-3.png 1100w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-3-300x142.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-3-1024x484.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-3-768x363.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-config-3-20x9.png 20w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>You can choose to create an administrative user, or continue to use the generated password when working with Jenkins.<\/p>\n<p>After creating an account, Jenkins is ready to be used. \u00a0Before we create our first workflow, or job, we need to install an extra plugin.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3061 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-manage.png\" alt=\"Manage Jenkins\" width=\"1100\" height=\"530\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-manage.png 1100w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-manage-300x145.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-manage-1024x493.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-manage-768x370.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-manage-20x10.png 20w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>You&#8217;ll want to choose to\u00a0<strong>Manage Jenkins<\/strong> which will bring us to a list of management sections, one of which being a section for managing plugins.<\/p>\n<p>Choose to\u00a0<strong>Manage Plugins<\/strong> and do a search for the\u00a0<strong>Post-Build Script<\/strong> plugin.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3062 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-postbuildscript-plugin.png\" alt=\"Install Jenkins Post-Build Script Plugin\" width=\"1100\" height=\"529\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-postbuildscript-plugin.png 1100w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-postbuildscript-plugin-300x144.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-postbuildscript-plugin-1024x492.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-postbuildscript-plugin-768x369.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-postbuildscript-plugin-20x10.png 20w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>This plugin will allow us to execute scripts on the Jenkin host after the build has completed without errors.\u00a0 <span style=\"font-weight: 400\">We need this so Jenkins\u00a0 can deploy the \u00a0 JAR after it has been packaged<\/span>.<\/p>\n<p>Now Jenkins as a whole has been configured. \u00a0While it is ready for us to create jobs, we&#8217;re first going to get <a href=\"https:\/\/www.couchbase.com\" target=\"_blank\" rel=\"noopener noreferrer\">Couchbase<\/a> ready to go.<\/p>\n<h2>Preparing Couchbase with a Bucket for Document Storage<\/h2>\n<p>Couchbase isn&#8217;t the highlight of this example, but since we&#8217;re using one of my old projects, it was a requirement per the project.<\/p>\n<p>If you haven&#8217;t already downloaded Couchbase, do so now and walk through the configuration. \u00a0For help with configuring Couchbase, check out a <a href=\"https:\/\/www.couchbase.com\/blog\/getting-started-with-couchbase-server-on-mac-os\/\" target=\"_blank\" rel=\"noopener noreferrer\">previous article<\/a> I wrote.<\/p>\n<p>What is important is the Bucket that we&#8217;ll be using. \u00a0Make sure to create a Bucket titled\u00a0<strong>restful-sample<\/strong> with at least a primary\u00a0N1QL index.<\/p>\n<p>If you need help with any of this, a full write-up of our project can be found <a href=\"https:\/\/www.thepolyglotdeveloper.com\/2016\/01\/create-a-full-stack-app-using-java-and-couchbase-server\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. \u00a0Of course, that write-up doesn&#8217;t include continuous deployment with Jenkins.<\/p>\n<p>Now we can focus on our pipeline.<\/p>\n<h2>Creating a Job for Building and Deploying an Application Developed\u00a0with Java<\/h2>\n<p>With Jenkins and Couchbase ready to go we can focus on creating a job that will control our pipeline. \u00a0To reiterate on our plan, we will be pulling from GitHub, packaging a JAR in the build process, and deploying that JAR during the post-build (deployment) process.<\/p>\n<p>Go ahead and create a new job in Jenkins. \u00a0The first thing you&#8217;ll be asked is for a project name as well as the type of project name.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3054 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-job-java-freestyle.png\" alt=\"Jenkins Freestyle Java Project\" width=\"1100\" height=\"441\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-job-java-freestyle.png 1100w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-job-java-freestyle-300x120.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-job-java-freestyle-1024x411.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-job-java-freestyle-768x308.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-job-java-freestyle-20x8.png 20w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>Give the job a unique name and also make sure to use\u00a0<strong>Freestyle Project<\/strong> from the list. \u00a0When configuring this project, our first concern is the GitHub repository that we&#8217;ll be using.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3055 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-git-java-project.png\" alt=\"Jenkins Java Project Source Control\" width=\"1100\" height=\"654\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-git-java-project.png 1100w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-git-java-project-300x178.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-git-java-project-1024x609.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-git-java-project-768x457.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-git-java-project-20x12.png 20w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>If your repository is not public, don&#8217;t worry as you can add credentials, but for this example my project is public.<\/p>\n<p>I&#8217;m using the project found here:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">https:\/\/github.com\/couchbaselabs\/restful-angularjs-java<\/pre>\n<p>Feel free to use your own project if you&#8217;d like. \u00a0With the source control figured out, let&#8217;s move onto the\u00a0<strong>Build<\/strong> step.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3056 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-java-project-build.png\" alt=\"Jenkins Build Java Project\" width=\"1100\" height=\"459\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-project-build.png 1100w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-project-build-300x125.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-project-build-1024x427.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-project-build-768x320.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-project-build-20x8.png 20w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>Here we can enter whatever shell commands that we want in order to build the application that was pulled from Git.<\/p>\n<p>We only want to generate a JAR file in this example, which can be done by adding the following command:<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">mvn clean package<\/pre>\n<p>This leaves us with a JAR file in a new\u00a0<strong>target<\/strong> directory that is only relevant to Jenkins at this time. \u00a0The final step is to kill any already running instance of the application and run it again.<\/p>\n<p>Since we installed the\u00a0<strong>Post-Build Plug-in Script<\/strong> we can define what happens with our build.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3057 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-java-post-build.png\" alt=\"Jenkins Post-Build Java Actions\" width=\"1100\" height=\"786\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-post-build.png 1100w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-post-build-300x214.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-post-build-1024x732.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-post-build-768x549.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/jenkins-java-post-build-20x14.png 20w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>In this example we aren&#8217;t deploying it to another machine, but we could. \u00a0Instead we&#8217;re just going to run it on the local machine.<\/p>\n<p>Choose to execute a shell script and include the following:<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">ps | grep java-fullstack | awk '{print $1}' | xargs kill -9 || true\r\nenv SERVER.PORT=8081 nohup java -jar .\/target\/java-fullstack-1.0-SNAPSHOT.jar &amp;<\/pre>\n<p>The above is cheating a little, but it&#8217;s necessary because we&#8217;re running everything locally on the same machine.<\/p>\n<p>The first command will search for any running process on my Mac that looks like our Java application. \u00a0Once found it will kill the process. \u00a0Even if it doesn&#8217;t find the process it will return true because of our pipe. \u00a0This prevents the job from failing.<\/p>\n<p>After the process is stopped, we run the built JAR in the background.<\/p>\n<p>Keep in mind that your script may be a bit different if you&#8217;re running locally on Linux or Windows. \u00a0In a production scenario, you&#8217;ll probably use the SSH plugin for Jenkins and push the JAR to some server and restart the controlling daemon.<\/p>\n<p>Go ahead and try to run the job using the\u00a0<strong>Build Now<\/strong> button. \u00a0If you don&#8217;t want to initiate it manually, consider adding a hook or a cron timer in the configuration area that we had just explored.<\/p>\n<p>If everything goes well, you&#8217;ll have your Java application accessible at <strong>https:\/\/localhost:8081<\/strong> and it will communicate with Couchbase Server.<\/p>\n<h2>Conclusion<\/h2>\n<p>You just saw how to <span style=\"font-weight: 400\">deploy a JAR file in <\/span><a href=\"https:\/\/jenkins.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jenkins<\/a> to do continuous deployment of a Java application that communicates with Couchbase Server. \u00a0This Jenkins configuration will pull from GitHub, build a JAR, and deploy it. \u00a0While it should be a little more polished in a production scenario, it is a good way to get started.<\/p>\n<p>Want to use Jenkins for continuous deployment of microservices bundled into Docker containers? \u00a0Check out a previous article that I wrote titled,\u00a0<a href=\"https:\/\/www.thepolyglotdeveloper.com\/2017\/04\/continuous-deployment-of-web-application-containers-with-jenkins-and-docker\/\" target=\"_blank\" rel=\"noopener noreferrer\">Continuous Deployment of Web Application Containers with Jenkins and Docker<\/a>.<\/p>\n<p>Want more information on using Java continuous deployment with Couchbase? Check out the <a href=\"https:\/\/www.couchbase.com\/developers\/\" target=\"_blank\" rel=\"noopener noreferrer\">Couchbase Developer Portal<\/a> for examples and documentation.<\/p>\n<p>I encourage you to check out the Couchbase Connect 2016 <a href=\"https:\/\/youtu.be\/Bq8zkcbnRac?t=26m25s\" target=\"_blank\" rel=\"noopener noreferrer\">keynote demonstration<\/a> if you haven&#8217;t already.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lately I&#8217;ve been working a lot with Jenkins to run Java JAR files for continuous deployment of one of my applications. \u00a0In case you haven&#8217;t seen it, the keynote demonstration given at Couchbase Connect 2016 used Jenkins to build and [&hellip;]<\/p>\n","protected":false},"author":63,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,1818],"tags":[1919,1920,1567,1758,1565,1874,1921,1922],"ppma_author":[9032],"class_list":["post-3048","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-java","tag-cd","tag-continuous-delivery","tag-continuous-deployment","tag-gradle","tag-jenkins","tag-maven","tag-pipeline","tag-ssh"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.7.1 (Yoast SEO v25.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Continuous Deployment Pipeline: Run JAR with Jenkins + Java<\/title>\n<meta name=\"description\" content=\"See how to create and run a JAR file using Jenkins and Java, resulting in a continuous deployment pipeline that includes building and deploying to a server.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create a Continuous Deployment Pipeline with Jenkins and Java\" \/>\n<meta property=\"og:description\" content=\"See how to create and run a JAR file using Jenkins and Java, resulting in a continuous deployment pipeline that includes building and deploying to a server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/thepolyglotdeveloper\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-13T15:04:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-07T11:45:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-config-1.png\" \/>\n<meta name=\"author\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@nraboy\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/\"},\"author\":{\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1\"},\"headline\":\"Create a Continuous Deployment Pipeline with Jenkins and Java\",\"datePublished\":\"2017-04-13T15:04:25+00:00\",\"dateModified\":\"2023-09-07T11:45:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/\"},\"wordCount\":1335,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"keywords\":[\"cd\",\"continuous delivery\",\"Continuous Deployment\",\"gradle\",\"Jenkins\",\"maven\",\"pipeline\",\"ssh\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/\",\"name\":\"Continuous Deployment Pipeline: Run JAR with Jenkins + Java\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-04-13T15:04:25+00:00\",\"dateModified\":\"2023-09-07T11:45:33+00:00\",\"description\":\"See how to create and run a JAR file using Jenkins and Java, resulting in a continuous deployment pipeline that includes building and deploying to a server.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create a Continuous Deployment Pipeline with Jenkins and Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1\",\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8863514d8bed0cf6080f23db40e00354\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"caption\":\"Nic Raboy, Developer Advocate, Couchbase\"},\"description\":\"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand.\",\"sameAs\":[\"https:\/\/www.thepolyglotdeveloper.com\",\"https:\/\/www.facebook.com\/thepolyglotdeveloper\",\"https:\/\/x.com\/nraboy\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/nic-raboy-2\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Continuous Deployment Pipeline: Run JAR with Jenkins + Java","description":"See how to create and run a JAR file using Jenkins and Java, resulting in a continuous deployment pipeline that includes building and deploying to a server.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/","og_locale":"en_US","og_type":"article","og_title":"Create a Continuous Deployment Pipeline with Jenkins and Java","og_description":"See how to create and run a JAR file using Jenkins and Java, resulting in a continuous deployment pipeline that includes building and deploying to a server.","og_url":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/","og_site_name":"The Couchbase Blog","article_author":"https:\/\/www.facebook.com\/thepolyglotdeveloper","article_published_time":"2017-04-13T15:04:25+00:00","article_modified_time":"2023-09-07T11:45:33+00:00","og_image":[{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/03\/jenkins-config-1.png","type":"","width":"","height":""}],"author":"Nic Raboy, Developer Advocate, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@nraboy","twitter_misc":{"Written by":"Nic Raboy, Developer Advocate, Couchbase","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/"},"author":{"name":"Nic Raboy, Developer Advocate, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1"},"headline":"Create a Continuous Deployment Pipeline with Jenkins and Java","datePublished":"2017-04-13T15:04:25+00:00","dateModified":"2023-09-07T11:45:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/"},"wordCount":1335,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["cd","continuous delivery","Continuous Deployment","gradle","Jenkins","maven","pipeline","ssh"],"articleSection":["Best Practices and Tutorials","Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/","url":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/","name":"Continuous Deployment Pipeline: Run JAR with Jenkins + Java","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-04-13T15:04:25+00:00","dateModified":"2023-09-07T11:45:33+00:00","description":"See how to create and run a JAR file using Jenkins and Java, resulting in a continuous deployment pipeline that includes building and deploying to a server.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/create-a-continuous-deployment-pipeline-with-jenkins-and-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create a Continuous Deployment Pipeline with Jenkins and Java"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1","name":"Nic Raboy, Developer Advocate, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8863514d8bed0cf6080f23db40e00354","url":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","caption":"Nic Raboy, Developer Advocate, Couchbase"},"description":"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand.","sameAs":["https:\/\/www.thepolyglotdeveloper.com","https:\/\/www.facebook.com\/thepolyglotdeveloper","https:\/\/x.com\/nraboy"],"url":"https:\/\/www.couchbase.com\/blog\/author\/nic-raboy-2\/"}]}},"authors":[{"term_id":9032,"user_id":63,"is_guest":0,"slug":"nic-raboy-2","display_name":"Nic Raboy, Developer Advocate, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","author_category":"","last_name":"Raboy","first_name":"Nic","job_title":"","user_url":"https:\/\/www.thepolyglotdeveloper.com","description":"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/3048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=3048"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/3048\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=3048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=3048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=3048"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=3048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}