【轉】springboot打包成jar無法訪問jsp頁面的解決方法

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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章