Operations 8 min read

How to Set Up Jenkins Automated Deployment for the Mall Project

This guide walks you through preparing scripts, uploading them, making them executable, and creating Jenkins jobs for each module of the multi‑module Mall project to achieve fully automated deployment using free‑style projects and SSH execution.

macrozheng
macrozheng
macrozheng
How to Set Up Jenkins Automated Deployment for the Mall Project
This article describes the dedicated Jenkins automated deployment method for the mall project.

Basic Usage of Jenkins

For basic Jenkins usage, refer to the article "Using Jenkins to One‑Click Package and Deploy SpringBoot Applications, That's How Easy!".

Preparing Scripts

First, prepare the scripts that need to be executed remotely.

Script files are stored in the mall project's /document/sh directory.

Before uploading, change all script files' line ending format in IDEA to LF , otherwise the scripts will fail to execute.

Upload all script files to the designated directory, here we upload to /mydata/sh .

Make all script files executable:

chmod +x ./mall-*

Creating Jobs in Jenkins

Next we will achieve automated deployment by creating tasks in Jenkins. Because mall is a multi‑module project, deployment differs from single‑module projects.

mall-admin

Since the creation of execution tasks for each module is largely the same, we will detail the mall‑admin module task creation; other modules will be briefly covered.

Select Build a free‑style software project for mall‑admin, then configure its Git repository address (using a Gitee URL in this example).

Create a build to install the dependent modules of the mall project; otherwise building the service module will fail due to missing modules.

# Only install mall-common, mall-mbg, mall-security modules
clean install -pl mall-common,mall-mbg,mall-security -am

Dependency project build diagram:

Create another build to individually build and package the mall‑admin module.

Add a remote SSH execution task to run the mall‑admin startup script.

Click Save to complete the mall‑admin execution task creation.

mall-portal

mall‑portal and other modules follow the same job creation method as mall‑admin; only the pom.xml location and script path need to be adjusted.

Copy a job from the mall‑admin module to create the mall‑portal job.

Modify the pom.xml location in the second build to ${WORKSPACE}/mall-portal/pom.xml .

Modify the SSH execution script path in the third build to /mydata/sh/mall-portal.sh .

Click Save to complete the mall‑portal execution task creation.

mall-search

Refer to the creation steps of mall‑admin and mall‑portal.

Job Creation Completed

Project Address

https://github.com/macrozheng/mall

Recommended Reading

Front‑back separation project, a problem encountered when introducing Spring Cloud Gateway!

Earned 1090 billion in one battle, the terrifying Zhang Yiming!

Front‑back separation project, how to elegantly implement file storage!

GitHub 19K+ stars, build an object storage service in 10 minutes!

Internet companies = 21st‑century state‑owned factories

Using Jenkins to one‑click package and deploy front‑end applications, that's how easy!

My 2019 GitHub open‑source journey!

GitHub 25K+ stars, SpringBoot e‑commerce project mall now has a SpringCloud version!

Spring Cloud tutorial covering most core components, must bookmark!

My GitHub open‑source project, from 0 to 20,000 stars!

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ci/cdAutomationOperationsDeploymentDevOpsSpringBootJenkins
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.