Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Intellij idea 2021.2 package and upload a sample analysis of running a spring boot project

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article shares with you about intellij idea 2021.2 packaging and uploading sample analysis of running spring boot projects. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

First, open the project in idea:

Here we take the storeback project as an example:

1. Open the maven panel on the right, as shown in the figure:

two,

2. Open Lifecycle and double-click to execute clean

As shown in the figure:

Note: after running clean, the previously generated target directory has been cleared

3. Notice that the target folder has not been generated in the project at this time:

Again in the maven panel, double-click to execute package

After the packaging is complete, the target folder has been generated

You can see the generated jar package here

Description: Liu Hongdi's Architecture Forest is an architecture-focused blog, address: https://www.cnblogs.com/architectforest

The corresponding source code can be obtained here: https://github.com/liuhongdi/

Or: https://gitee.com/liuhongdi

Description: author: Liu Hongdi email: 371125307@qq.com

Upload the jar package to the server and run:

1. Server: create a directory:

[root@jb51 ~] # mkdir / data/store/back [root@jb51 ~] # mkdir / data/store/back/tools [root@jb51 ~] # mkdir / data/store/back/logs [root@jb51 ~] # mkdir / data/store/back/jar

2. Upload the jar package to the server's jar directory

Server: view:

[root@jb51 conf.d] # cd / data/store/back/jar [root@jb51 jar] # lsstoreback-0.0.1-SNAPSHOT.jar

3. Server: run the jar package directly

[root@jb51 jar] $java-jar storeback-0.0.1-SNAPSHOT.jar-- spring.profiles.active=prd

4. View the effect from the browser:

5. Let the jar package run as daemon:

Create script

[root@jb51 tools] $vi startback.sh

The code is:

[root@blog tools] $more startback.shroud cards binexport BUILD_ID=dontKillmewhoamiWORKSPACE=/data/store/back/jarJDK_PATH=/usr/local/soft/jdk-15/bin/javaJAR_NAME=storeback-0.0.1-SNAPSHOT.jar # echo ${JAR_NAME} PID= `ps-ef | grep ${JAR_NAME} | grep-v grep | grep-v startup | awk'{print\ $2} '`echo $PID;if [! "$PID"] There is no "else echo" process in then echo. Kill the process PID$PID "kill-9$ PIDfi echo" service start "nohup ${JDK_PATH}-jar ${WORKSPACE} / ${JAR_NAME}-- spring.profiles.active=prd > > / data/store/back/logs/back.log 2 > & 1 &

Description: when a process exists, it will kill the process first, and then start the service.

Check the version of intellij idea:

4 check the version of spring boot:. _ _ / / _ _ _ (() _ _ _ |'_ _ _ | |\ / _ _ _ | | | (_ _ | |) )'| _ |. _ _ | _ | | _ | _ | | _\ _ _ | | / = | _ | = | _ _ / = /: Spring Boot:: (v2.5.4) 5 check the java version of the server: [root@blog jar] # java-- versionjava 15 2020-09-15Java (TM) SE Runtime Environment (build 15: 36-1562) Java HotSpot (TM) 64-Bit Server VM (build 15: 36-1562, mixed mode, sharing) Thank you for reading! This is the end of this article on "intellij idea 2021.2 package and upload sample Analysis of running spring boot Project". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report