記錄idea maven項目打包部署web項目mapper掃描失敗

來源:互聯網
上載者:User

標籤:檔案   添加   bsp   部署   打包   dea   idea   錯誤   map   

 

 最開始以為這裡出了問題,後來加上以後還是不能把mapper.xml打包進去

這是報的異常資訊

Mybatis啟動老是報綁定錯誤(找不到Mapper對應的 SQL配置),經過一番Google未能解決問題(大家都說是XML沒寫對之類的),根本就沒有懷疑到漏掉XML檔案,最後迫不得已,去查看了下 Maven打包後的war檔案,才找到問題。
廢話不多說,解決方式是,在pom.xml檔案中的build節點中,添加如下代碼:

<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
只要報resource標記為資源檔就不會出現問題就不用加入資源檔下的相關的打包.

 

記錄idea maven項目打包部署web項目mapper掃描失敗

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.