<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by DHRUV GAUTAM on Medium]]></title>
        <description><![CDATA[Stories by DHRUV GAUTAM on Medium]]></description>
        <link>https://medium.com/@executivedhruv07?source=rss-817319532adc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6vB-cXSUFXDkjCR4SD3DHA.jpeg</url>
            <title>Stories by DHRUV GAUTAM on Medium</title>
            <link>https://medium.com/@executivedhruv07?source=rss-817319532adc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 23:45:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@executivedhruv07/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[End-to-End Jenkins Pipeline for Java Projects: Complete CI/CD Guide]]></title>
            <link>https://executivedhruv07.medium.com/end-to-end-jenkins-pipeline-for-java-projects-complete-ci-cd-guide-86a4f72a530c?source=rss-817319532adc------2</link>
            <guid isPermaLink="false">https://medium.com/p/86a4f72a530c</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[DHRUV GAUTAM]]></dc:creator>
            <pubDate>Thu, 28 Aug 2025 08:12:25 GMT</pubDate>
            <atom:updated>2025-08-28T08:42:38.117Z</atom:updated>
            <content:encoded><![CDATA[<p>End-to-End Jenkins Pipeline for Java Projects: Complete CI/CD Guide</p><p>If you’re building modern Java applications, Continuous Integration and Continuous Deployment (CI/CD) is no longer optional—it’s essential. Jenkins, the most widely used automation server, empowers developers and DevOps teams to build, test, and deploy Java projects seamlessly.</p><p>In this guide, you’ll learn how to set up a complete end-to-end Jenkins pipeline for a Java project, from code commit to production deployment, using best practices for CI/CD automation.</p><p>---</p><p>What is a Jenkins Pipeline?</p><p>A Jenkins Pipeline is a series of automated stages that handle everything from source code integration to deployment. With Pipeline as Code (via a `Jenkinsfile`), you can:</p><p>Automate Java build and deployment processes<br> Integrate with tools like Git, Maven, Docker, Kubernetes, and AWS<br> Ensure faster, reliable, and repeatable releases</p><p>---</p><p>Why Use Jenkins for Java CI/CD?</p><p>Open-source &amp; highly customizable<br>Extensive plugin ecosystem (Maven, Gradle, Docker, SonarQube, GitHub, GitLab)<br>Pipeline-as-Code support for better version control<br> Works seamlessly for microservices, monolithic apps, and cloud deployments</p><p>---</p><p>Prerequisites for Jenkins CI/CD Pipeline</p><p>To set up your pipeline, you’ll need:</p><p>A Java project (preferably Maven or Gradle based)<br>A running Jenkins server (with admin access)<br> Required Jenkins plugins: Git, Pipeline, Maven/Gradle, Docker, SSH Agent<br> Access to GitHub/GitLab/Bitbucket repository<br> A deployment environment (e.g., Tomcat, AWS EC2, Docker, or Kubernetes)</p><p>---</p><p>Step 1: Install &amp; Configure Jenkins</p><p>1. Install Jenkins on your server or container (Ubuntu/Docker/AWS).<br>2. Go to Manage Jenkins → Manage Plugins and install:</p><p>Git Plugin<br> Pipeline Plugin<br> Maven Integration Plugin<br> SSH Agent Plugin<br>3. Configure tools in Manage Jenkins → Global Tool Configuration:</p><p>Set up JDK (Java 17 or 11 recommended)<br> Add Maven or Gradle</p><p>---</p><p>Step 2: Create a Pipeline Job</p><p>1. In Jenkins Dashboard → New Item → Pipeline<br>2. Name it: `java-ci-cd-pipeline`<br>3. Choose Pipeline script from SCM(if using a `Jenkinsfile` in Git)</p><p>---</p><p>Step 3: Jenkinsfile for Java Project</p><p>Here’s an optimized Jenkinsfile for a Maven-based Java project with CI/CD stages:</p><p>```groovy<br>pipeline {<br> agent any</p><p>tools {<br> maven &#39;Maven-3.8.6&#39;<br> jdk &#39;Java-17&#39;<br> }</p><p>stages {<br> stage(&#39;Checkout&#39;) {<br> steps {<br> git branch: &#39;main&#39;, url: &#39;https://github.com/your-org/java-project.git&#39;<br> }<br> }</p><p>stage(&#39;Build&#39;) {<br> steps {<br> sh &#39;mvn clean install&#39;<br> }<br> }</p><p>stage(&#39;Unit Test&#39;) {<br> steps {<br> sh &#39;mvn test&#39;<br> }<br> }</p><p>stage(&#39;Code Quality&#39;) {<br> steps {<br> // Optional: Integrate with SonarQube<br> sh &#39;mvn sonar:sonar&#39;<br> }<br> }</p><p>stage(&#39;Package&#39;) {<br> steps {<br> sh &#39;mvn package&#39;<br> }<br> }</p><p>stage(&#39;Deploy to Staging&#39;) {<br> steps {<br> sshagent([&#39;your-ssh-key&#39;]) {<br> sh &#39;&#39;&#39;<br> scp target/your-app.jar ubuntu@staging-server:/opt/app/<br> ssh ubuntu@staging-server &quot;systemctl restart java-app&quot;<br> &#39;&#39;&#39;<br> }<br> }<br> }</p><p>stage(&#39;Approval &amp; Production Deploy&#39;) {<br> when {<br> branch &#39;main&#39;<br> }<br> steps {<br> input &quot;Approve Deployment to Production?&quot;<br> sshagent([&#39;your-ssh-key&#39;]) {<br> sh &#39;&#39;&#39;<br> scp target/your-app.jar ubuntu@prod-server:/opt/app/<br> ssh ubuntu@prod-server &quot;systemctl restart java-app&quot;<br> &#39;&#39;&#39;<br> }<br> }<br> }<br> }</p><p>post {<br> success {<br> echo &#39;Jenkins pipeline executed successfully!&#39;<br> }<br> failure {<br> echo &#39;Pipeline failed. Check logs for details.&#39;<br> }<br> }<br>}<br>```</p><p>---</p><p>Step 4: Set Up Pipeline Triggers</p><p>Git Webhooks (recommended): Trigger pipeline on every code push<br>SCM Polling:** e.g., `H/5 * * * *` (poll every 5 minutes)<br>Manual triggers via Jenkins UI</p><p>---</p><p>Step 5: Add CI/CD Enhancements</p><p>Code Analysis &amp; Quality Gate: Integrate SonarQube or PMD<br>Containerization: Use Docker for packaging<br>Cloud Deployment: Deploy on AWS EC2, EKS, or Elastic Beanstalk<br>Blue Ocean Plugin: For a visual pipeline view</p><p>---</p><p>Benefits of an End-to-End Jenkins CI/CD Pipeline</p><p>Faster and reliable Java builds<br> Reduced manual errors with automated deployments<br> Continuous feedback for developers<br> Easy integration with cloud platforms and Kubernetes</p><p>---</p><p>Final Thoughts</p><p>An end-to-end Jenkins pipeline for Java projects enables teams to ship features faster with confidence, improving both code quality and release frequency. Whether you’re deploying to on-premises servers or cloud-native environments, Jenkins offers a scalable solution for modern DevOps practices.</p><p>By implementing this pipeline, your Java project will have a robust CI/CD workflow that aligns with best DevOps practices and future-proof scalability.</p><p>---</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86a4f72a530c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>