Home >Java >javaTutorial >How to deploy springboot project under Linux

How to deploy springboot project under Linux

PHPz
PHPzforward
2023-05-14 22:43:041551browse

1. Add the springboot maven plug-in to the pom file

<build>
 <plugins>
 <plugin>
  <groupid>org.springframework.boot</groupid>
  spring-boot-maven-plugin</artifactid>
 </plugin>
 </plugins>
</build>

2. Execute the maven command to generate the jar package

Before executing this step, you must ensure that the maven environment is configured. , the maven environment configuration process is as follows

a. Add a maven_home environment variable to the system environment variable, followed by your local maven path

b. Add %maven_home% to the path \bin

c. Execute maven -v in the dos command to see if the environment is correct

Make sure the maven environment is configured properly, and execute mvn clean install -dmaven.test.skip in the terminal window =true

You can see that

How to deploy springboot project under Linux

has been successfully packaged. You can see one more target package in the project structure, which is packaged The jar package is below

How to deploy springboot project under Linux

3. Upload the jar package to the linux server

a. Execute the #sudo yum install lrzsz -y command

This command will install a software that can download and upload

b. Execute the #rz command

This is the upload command. After execution, select the file and you can upload it

4. Execute #nohup java -jar demo-0.0.1-snapshot.jar & command

Execute this command to start the jar package in the background

Complete these 4 steps Can you access it on the server? IP port

How to deploy springboot project under Linux

The above is the detailed content of How to deploy springboot project under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete