spring boot war without tomcat embedded

后端 未结 5 1643
孤街浪徒
孤街浪徒 2020-11-28 10:23

I want to create a war file without embedded tomcat with maven. Here the relevant part of my pom

...

    org.springframework.bo         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 11:07

    I think that the easiest way to build a final WAR from your existing Spring Boot project without embedded Tomcat is the following:

    1) Set WARpackaging for your artifact: war

    2) Set the Tomcat Server dependency to provide:

    
        org.springframework.boot
        spring-boot-starter-tomcat
        provided
    
    

    If some of your existing Spring Boot dependencies contain it by default, just exclude it. Example:

    
        org.springframework.boot
        spring-boot-starter-web
            
                
                    org.springframework.boot
                    spring-boot-starter-tomcat
                
            
    
    

    That is it.

提交回复
热议问题