项目war包模式改jar包模式修改配置

springboot

Posted by lwj108 on June 10, 2019

1.注释war包模式

<!--<packaging>war</packaging>-->
<packaging>jar</packaging>

2.注释war-plugin

<!--<build>
  <plugins>
    <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.0.0</version>
    </plugin>
  </plugins>
</build>-->

<build>
<plugins>
    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
        <mainClass>org.supwisdom.Application</mainClass> 
        </configuration>
    </plugin>
</plugins>
</build>

3.注释掉spring-boot-starter-tomcat相关依赖

4.注释Application.java中SpringApplicationBuilder configure

//    @Override
//    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//        return application.sources(Application.class);
//    }
    
    public static void main(String[] args) throws Exception {
      System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(Application.class, args);
    }

启动方式: cd 当前服务pom.xml同目录下 mvn clean package nohup java -jar target/***.jar >log.out