Java back-end development light speed introductory tutorial (two) mac+windows SpringBoot rapid development and deployment of Java Web projects

Rapid development of JavaWeb based on Springboot

Material preparation

  • Intellij Ultimate,
    a man with his own JDK and Springboot
  • Xshell/iTerm
    remote operation server terminal media

Project creation

Run IntelliJ IDEA, as shown in the figure below, click Creat New Project to
Insert picture description hereselect Spring Initializer, select SDK, and use the default option (Default) for Service Url. Click next and
Insert picture description herefill in the English description as shown in the figure below. It is recommended that Type use Maven (the Maven tutorial follows Fill in), click next to
Insert picture description herecheck as shown in the figure below, click next
Insert picture description hereas shown in the figure below, and click finish
Insert picture description here

Project Development

Write specific content according to your needs, it is recommended to refer to https://www.cnblogs.com/wmyskxz/p/9010832.html

Project packaging and deployment

Enter the project directory in cmd/terminal and use the mvn clean package package command
(maven configuration is not mentioned first) to enter the Intellij installation directory (if it is a mac, you need to find Intellij in the application, right-click to display the package, and enter content)/plugins/ maven/lib/maven3/bin, find mvn,
drag mvn into cmd/terminal, enter the space, and enter clean package (this is actually the mvn clean package command, but you must configure the environment variables of maven to directly use mvn) to
package The good project is in the target, upload it to the server with XFtp/FileZilla,
use Xshell/iTerm to communicate with the server,

  • Execute java -jar (name).jar in the terminal to deploy the project to the public network ip.
    At this time, closing the terminal port will close the project, but the port occupation will not be closed .
  • Use netstat -anp to view port occupation, and view pid at the right end of each line (take 123 as an example)
  • Use kill 123 to turn off the process that occupies the port to run normally (this seems quite contradictory, the project is closed, but the process that occupies the port is left)
  • Execute nohup java -jar name.jar> log.file 2>&1 & in the terminal, and run the project in the background.
    At this time, closing the window will not close the project
    . The meaning of the second half sentence is to store the running log in the corresponding location

Guess you like

Origin blog.csdn.net/Kaiser_syndrom/article/details/102784345