Spring Boot packaging the project to War

依然范特西╮ 提交于 2019-12-25 11:57:07

问题


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);
    }

}

回答1:


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

gradle assemble


来源:https://stackoverflow.com/questions/44567372/spring-boot-packaging-the-project-to-war

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!