springboot打包成jar,無法訪問jsp 頁面的解決方法:
- 將maven打包插件的版本改爲1.4.2
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.2.RELEASE</version>
</plugin>
- 配置
< resources>
將 webapp 打包進target/classes
目錄,其中< targetPath>META-INF/resources</ targetPath>
指定將webapp
打包到target/classes
目錄的META-INF/resources
目錄下,必須這樣配置,否則會出錯。
<resources>
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>