springBoot项目简单部署

在pom.xml中加入

 <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

在这里插入图片描述

把target下打包好的jar上传服务器
在这里插入图片描述
在这里插入图片描述
启动命令
–server.port=8888 是设置端口的
shop.log是日志输出文件,目前路径是当前目录下,其他路径自己再改了

 nohup java -jar com.sise-1.0-SNAPSHOT.jar --server.port=8988 >>./shop.log 2>&1 &

查看日志

tail -f -n 100 shop.log

结果打印:


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.0.RELEASE)

2020-01-06 16:57:21.930  INFO 12982 --- [           main] com.sise.Application                     : Starting Application v1.0-SNAPSHOT on VM_0_8_centos with PID 12982 (/home/com.sise-1.0-SNAPSHOT.jar started by root in /home)
2020-01-06 16:57:21.934  INFO 12982 --- [           main] com.sise.Application                     : No active profile set, falling back to default profiles: default
2020-01-06 16:57:24.334  INFO 12982 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.amqp.rabbit.annotation.RabbitBootstrapConfiguration' of type [org.springframework.amqp.rabbit.annotation.RabbitBootstrapConfiguration$$EnhancerBySpringCGLIB$$399a7bd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-01-06 16:57:25.169  INFO 12982 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8988 (http)
2020-01-06 16:57:25.238  INFO 12982 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-01-06 16:57:25.239  INFO 12982 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/9.0.12
2020-01-06 16:57:25.260  INFO 12982 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
2020-01-06 16:57:25.464  INFO 12982 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-01-06 16:57:25.464  INFO 12982 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3375 ms
2020-01-06 16:57:25.539  INFO 12982 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2020-01-06 16:57:25.543  INFO 12982 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2020-01-06 16:57:25.543  INFO 12982 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2020-01-06 16:57:25.544  INFO 12982 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'formContentFilter' to: [/*]
2020-01-06 16:57:25.544  INFO 12982 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2020-01-06 16:57:26.221  INFO 12982 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-01-06 16:57:27.053  INFO 12982 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8988 (http) with context path ''
2020-01-06 16:57:27.056  INFO 12982 --- [           main] com.sise.Application                     : Started Application in 6.24 seconds (JVM running for 7.169)

或者写个shell去执行,新建一个start.sh文件,内容如下:

#!/bin/sh

nohup java -jar -Xms128M -Xmx128M -Xss228k com.sise-1.0-SNAPSHOT.jar \
   >> server-process.log 2>&1 & echo $! >> server.pid
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值