在springboot(1.5.11) 整合jsp过程,碰到了打包问题。具体就是用IDEA能正常运行,JSP页面能正常访问。但打包后,访问jsp报404错误,进入到jar包中,发现jsp没有打进包里。
后面查阅资料,发现springboot 1.5.X打包有问题。打包时需指定springboot的插件的版本,并手动把jsp配置进jar包,配置如下,问题得到解决。
<build> <finalName>test</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>1.4.2.RELEASE</version> <configuration> <mainClass>com.MyApplication</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> <resources> <resource> <directory>src/main/webapp</directory> <targetPath>META-INF/resources</targetPath> <includes> <include>**/**</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/**</include> </includes> <filtering>false</filtering> </resource> </resources> </build>