概述:springboot 在eclipse中使用内嵌服务容器启动,仅需run 启动主函数main来加载配置文件和容器初始化
问题:怎样部署springboot为可执行jar
springboot 使用内嵌容器来提供服务,但是当我使用maven 打可执行jar时,其无法将静态文件(html/jsp)一并打入可执行文件
解决:使用maven resource将静态文件包含在内(注意:targetPath)
4.0.0 lhc.application.mes spring-application-webapp-boot jar 0.0.1-SNAPSHOT spring-application-webapp-boot Maven Webapp org.springframework.boot spring-boot-starter-parent 1.3.2.RELEASE ${basedir}/../.. / 1.8 7.0.52 org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat provided org.apache.tomcat.embed tomcat-embed-jasper compile org.springframework.boot spring-boot-loader org.eclipse.jdt.core.compiler ecj 4.5.1 runtime com.atomikos transactions-hibernate3 3.7.0 com.atomikos transactions 3.7.0 com.atomikos transactions-api 3.7.0 com.atomikos transactions-jdbc 3.7.0 com.atomikos transactions-jta 3.7.0 org.hibernate hibernate-validator 5.0.2.Final org.springframework.boot spring-boot-starter-test test taglibs standard 1.1.2 commons-dbcp commons-dbcp 1.4 commons-collections commons-collections 3.1 commons-pool commons-pool 1.6 org.hibernate.javax.persistence hibernate-jpa-2.1-api 1.0.0.Final org.springframework.security spring-security-core 3.2.0.RELEASE com.alibaba fastjson 1.2.7 org.hibernate hibernate-core jstl jstl 1.1.2 ${basedir}/src/main/webapp META-INF/resources **/** ${basedir}/src/main/resources **/** org.springframework.boot spring-boot-maven-plugin org.apache.tomcat.maven tomcat7-maven-plugin 2.2 org.apache.maven.plugins maven-surefire-plugin false spring-application-webapp-boot