<?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"><channel><title><![CDATA[Integrate Nexus with Jenkins]]></title><description><![CDATA[Integrate Nexus with Jenkins]]></description><link>https://devopschannel.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 27 Oct 2026 00:18:11 GMT</lastBuildDate><atom:link href="https://devopschannel.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building a CI/CD Pipeline for Java WebApps on Tomcat with GitHub Actions]]></title><description><![CDATA[This guide outlines the process of automating the deployment of a Java web application to an Apache Tomcat server using GitHub Actions. By leveraging…]]></description><link>https://devopschannel.hashnode.dev/building-a-ci-cd-pipeline-for-java-webapps-on-tomcat-with-github-actions</link><guid isPermaLink="true">https://devopschannel.hashnode.dev/building-a-ci-cd-pipeline-for-java-webapps-on-tomcat-with-github-actions</guid><dc:creator><![CDATA[Pankaj Linghate]]></dc:creator><pubDate>Fri, 16 Oct 2026 08:06:40 GMT</pubDate><content:encoded><![CDATA[<p>This guide outlines the process of automating the deployment of a Java web application to an Apache Tomcat server using GitHub Actions. By leveraging CI/CD, developers can ensure that every code commit is automatically built, tested, and deployed, significantly reducing manual overhead and minimizing deployment errors in production or staging environments.</p>
<h3>Prerequisites</h3>
<p>Before setting up the pipeline, ensure you have the following:</p>
<p>A Java project managed by Maven or Gradle.</p>
<p>A GitHub repository containing your source code.</p>
<p>A remote Tomcat server accessible via SSH.</p>
<p>SSH credentials (private key) stored securely in your GitHub repository secrets.</p>
<p>Configuring GitHub Secrets</p>
<p>To keep your deployment secure, never hardcode sensitive information in your workflow files. Navigate to your GitHub repository, go to Settings, then Secrets and variables, and add the following:</p>
<p>SSH_HOST: The IP address or domain of your Tomcat server.</p>
<p>SSH_USER: The username for the server.</p>
<p>SSH_PRIVATE_KEY: The private key used to authenticate with the server.</p>
<p>Creating the Workflow File</p>
<p>Create a file in your repository at .github/workflows/deploy.yml. This file defines the automation steps. The workflow will trigger on every push to the main branch.</p>
<p>Defining the Build and Deploy Steps</p>
<p>The workflow consists of two main phases: building the artifact and deploying it to the server.</p>
<p>name: Java CI/CD to Tomcat</p>
<p>on: push: branches: [ main ]</p>
<p>jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up JDK 17 uses: actions/setup-java@v3 with: java-version: '17' distribution: 'temurin' - name: Build with Maven run: mvn clean package - name: Upload Artifact uses: actions/upload-artifact@v3 with: name: webapp path: target/*.war</p>
<p>deploy: needs: build runs-on: ubuntu-latest steps: - name: Download Artifact uses: actions/download-artifact@v3 with: name: webapp - name: Deploy to Tomcat via SCP uses: appleboy/scp-action@master with: host: \({{ secrets.SSH_HOST }} username: \){{ secrets.SSH_USER }} key: \({{ secrets.SSH_PRIVATE_KEY }} source: "*.war" target: "/opt/tomcat/webapps/" - name: Restart Tomcat uses: appleboy/ssh-action@master with: host: \){{ secrets.SSH_HOST }} username: \({{ secrets.SSH_USER }} key: \){{ secrets.SSH_PRIVATE_KEY }} script: sudo systemctl restart tomcat</p>
<p>Understanding the Pipeline Logic</p>
<p>Build Phase: The pipeline uses the ubuntu-latest runner to check out the code, set up the Java environment, and run the Maven package command. This generates the WAR file. The artifact is then uploaded to GitHub so it can be passed to the next job.</p>
<p>Deploy Phase: The pipeline downloads the WAR file and uses the appleboy/scp-action to securely copy the file to the Tomcat webapps directory.</p>
<p>Restart Phase: Finally, the pipeline executes a remote SSH command to restart the Tomcat service, ensuring the new version of the application is loaded.</p>
<p>Best Practices for Production</p>
<p>For production environments, consider adding a testing step after the build phase to run unit tests. Additionally, instead of restarting the entire Tomcat service, you can use the Tomcat Manager API to deploy the WAR file without downtime. Always ensure your server has restricted firewall rules, allowing SSH access only from trusted IP addresses.</p>
]]></content:encoded></item><item><title><![CDATA[Integrate Nexus with Jenkins | Automate Artifact Deployment via CI/CD]]></title><description><![CDATA[Integrate Nexus with Jenkins | Automate Artifact Deployment via CI/CD]]></description><link>https://devopschannel.hashnode.dev/integrate-nexus-with-jenkins-automate-artifact-deployment-via-ci-cd</link><guid isPermaLink="true">https://devopschannel.hashnode.dev/integrate-nexus-with-jenkins-automate-artifact-deployment-via-ci-cd</guid><category><![CDATA[devops cicd]]></category><category><![CDATA[Devops]]></category><category><![CDATA[ Jenkins, DevOps]]></category><category><![CDATA[integration]]></category><category><![CDATA[Nexus Repository]]></category><dc:creator><![CDATA[Pankaj Linghate]]></dc:creator><pubDate>Fri, 04 Sep 2026 21:08:12 GMT</pubDate><content:encoded><![CDATA[<p>In the world of software development, Continuous Integration and Continuous Deployment (CI/CD) have become essential practices for delivering high-quality software efficiently. This document outlines the steps to integrate Nexus Repository Manager with Jenkins, enabling automated artifact deployment. By leveraging this integration, teams can streamline their build processes, manage dependencies effectively, and ensure that artifacts are readily available for deployment.</p>
<h1>Introduction</h1>
<p>Nexus Repository Manager serves as a powerful tool for managing software artifacts, while Jenkins is a widely-used automation server for building, testing, and deploying applications. Integrating these two tools allows developers to automate the entire lifecycle of their applications, from code commit to deployment. This document will guide you through the setup and configuration required to achieve seamless integration between Nexus and Jenkins.</p>
<p>Prerequisites</p>
<p>Before starting the integration process, ensure you have the following:</p>
<p>Jenkins Installed: Make sure you have Jenkins installed and running. You can download it from the <a href="https://www.jenkins.io/download/">Jenkins website</a>.</p>
<p>Nexus Repository Manager Installed: You can download Nexus from the <a href="https://www.sonatype.com/nexus-repository-oss">Sonatype website</a>.</p>
<p>Jenkins Plugins: Install the following Jenkins plugins:</p>
<p>Nexus Artifact Uploader</p>
<p>Pipeline (if using Jenkins Pipeline)</p>
<p>Nexus Repository: Create a hosted repository in Nexus where you will deploy your artifacts.</p>
<p>Step 1: Configure Nexus Repository</p>
<p>Log in to Nexus: Access your Nexus Repository Manager by navigating to its URL in your web browser.</p>
<p>Create a Hosted Repository:</p>
<p>Go to the "Repositories" section.</p>
<p>Click on "Create repository" and select the type (e.g., Maven2 (hosted)).</p>
<p>Configure the repository settings (name, version policy, etc.) and save.</p>
<p>Generate a User Token:</p>
<p>Navigate to "Administration" &gt; "Security" &gt; "Users".</p>
<p>Create a new user or use an existing one with the necessary permissions to deploy artifacts.</p>
<p>Generate an API token for this user, which will be used for authentication in Jenkins.</p>
<p>Step 2: Configure Jenkins</p>
<p>Install Required Plugins:</p>
<p>Go to "Manage Jenkins" &gt; "Manage Plugins".</p>
<p>Search for and install the "Nexus Artifact Uploader" plugin.</p>
<p>Configure Nexus Credentials:</p>
<p>Go to "Manage Jenkins" &gt; "Manage Credentials".</p>
<p>Add a new credential:</p>
<p>Kind: Username with password</p>
<p>Username: Your Nexus username</p>
<p>Password: Your Nexus API token</p>
<p>ID: nexus-credentials (or any identifier you prefer)</p>
<p>Create a New Job:</p>
<p>Click on "New Item" in Jenkins.</p>
<p>Choose "Pipeline" or "Freestyle project" based on your preference.</p>
<p>Name your job and click "OK".</p>
<p>Step 3: Create a Jenkins Pipeline</p>
<p>If you are using a Pipeline job, you can define your CI/CD process in a Jenkinsfile. Below is a sample Jenkinsfile that demonstrates how to build a Maven project and deploy the artifact to Nexus.</p>
<p>pipeline { agent any</p>
<pre><code class="language-plaintext">environment {
    NEXUS_CREDENTIALS = credentials('nexus-credentials')
    NEXUS_URL = 'http://your-nexus-url:8081/repository/your-repo/'
}

stages {
    stage('Build') {
        steps {
            script {
                // Run Maven build
                sh 'mvn clean package'
            }
        }
    }

    stage('Deploy to Nexus') {
        steps {
            script {
                // Upload artifact to Nexus
                nexusArtifactUploader artifacts: [
                    [artifactId: 'your-artifact-id', 
                     classifier: '', 
                     file: 'target/your-artifact.jar', 
                     groupId: 'your.group.id', 
                     version: '1.0.0']
                ],
                nexusUrl: "${NEXUS_URL}",
                groupId: 'your.group.id',
                version: '1.0.0',
                repository: 'your-repo',
                credentialsId: 'nexus-credentials'
            }
        }
    }
}
</code></pre>
<p>}</p>
<p>Explanation of the Pipeline</p>
<p>Agent: Defines where the pipeline will run. any means it can run on any available agent.</p>
<p>Environment Variables: Store Nexus credentials and URL for easy access.</p>
<p>Stages:</p>
<p>Build: Executes the Maven build command to create the artifact.</p>
<p>Deploy to Nexus: Uses the nexusArtifactUploader to upload the built artifact to the specified Nexus repository.</p>
<p>Step 4: Run the Jenkins Job</p>
<p>Save the Pipeline: After configuring the Jenkinsfile, save your job.</p>
<p>Build the Job: Click on "Build Now" to trigger the pipeline.</p>
<p>Monitor the Build: Check the console output for any errors and ensure the artifact is successfully uploaded to Nexus.</p>
<p>Step 5: Verify Artifact in Nexus</p>
<p>Log in to Nexus: Go back to your Nexus Repository Manager.</p>
<p>Navigate to Your Repository: Find the repository where you deployed the artifact.</p>
<p>Check for the Artifact: Verify that your artifact appears in the repository with the correct version.</p>
<p><em><strong>Conclusion</strong></em></p>
<p>Integrating Nexus with Jenkins allows for a streamlined CI/CD process, enabling teams to automate the deployment of artifacts efficiently. By following the steps outlined in this document, you can set up a robust pipeline that not only builds your applications but also manages artifact deployment seamlessly. This integration enhances collaboration, reduces manual errors, and accelerates the delivery of high-quality software.</p>
]]></content:encoded></item></channel></rss>