springboot war包模式改成jar包模式

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
java -jar target/***.jar

posted @ 2019-05-14 17:00  夏天的棒棒冰  阅读(4644)  评论(0编辑  收藏  举报