由於現在項目采用的是 jboot 框架,升級最新版本2.1.5后,需要將原來的webroot資源改到 src/main/webapp目錄下,
發現轉移后,通過框架的app.java入口main函數無法將新增過來的webapp資源更新到target/classes下面,
所以用下面maven配置文件 可以有效解決。
<plugin> <artifactId>maven-resources-plugin</artifactId> <executions> <execution> <id>copy-resources</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/classes/webapp</outputDirectory> <resources> <resource> <directory>${basedir}/../jyb_project/src/main/webapp</directory> </resource> </resources> </configuration> </execution> </executions> </plugin>
上面的 resources 是欲拷貝的目錄, outputDirectory是目標目錄。
------------------------------------------------------------------------------
這個maven流弊之處在於 支持html,等靜態資源 熱編譯,在當前改動的html下面 按下ctrl+f9或者點擊build project 可以自動將改動html平移到了target目錄下。
難道是 idea 的 build project會根據maven的配置文件的參數編譯? 反正 很流弊,記錄一下。