Package a spring boot application including JSPs and static resources

前端 未结 5 2006
面向向阳花
面向向阳花 2020-12-29 11:46

I want to package a spring-boot application as jar, and I do so with mvn package.

This produces a jar which does not contain any /WEB-INF/jsp

5条回答
  •  时光说笑
    2020-12-29 12:19

    To create a runnable JAR with Spring Boot, use the spring-boot-maven-plugin in your pom.xml

    
    
        
        org.springframework.boot
        spring-boot-maven-plugin
        
    
    
    

    Maybe you want to have a look at my example application http://info.michael-simons.eu/2014/02/20/developing-a-web-application-with-spring-boot-angularjs-and-java-8/ (Source is on GitHub, App is live and runs from a JAR).

    One thing that you should note: JSP from JAR doesn't work due to some embedded Tomcat problems. I'm using Thymeleaf. If you need JSP, stay with the WAR deployment.

提交回复
热议问题