简体   繁体   中英

Spring Boot packaging the project to War

I have followed these steps to convert the pacakging from Jar to War.

But when i check my project folder or the build folder that is generated there is no war file generated only a war folder comes with MANIFEST.MF file

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-gradle-packaging

The changes i did in my gradle build file

apply plugin: 'war'

configurations {
    providedRuntime
}


dependencies {      
    providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')      
}

Added a new ServletInitializer class

public class ServletInitializer extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(DemoApplication.class);
    }

}

you can use the gradle command assemble in order to build the jar . This should help

gradle assemble

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM