我們的項(xiàng)目中,子項(xiàng)目(實(shí)際項(xiàng)目)依賴父項(xiàng)目(公共資源)。
<parent>
? <groupId>groupId</groupId>
? <artifactId>artifactId</artifactId>
? <version>1.0.0-SNAPSHOT</version>
</parent>
這個(gè)時(shí)候我們?cè)谧约旱捻?xiàng)目中新建webapp并且進(jìn)行編寫頁(yè)面代碼,打包的時(shí)候如果不進(jìn)行處理,webapp內(nèi)的web-inf內(nèi)容會(huì)進(jìn)入到target/項(xiàng)目/classes/web-inf目錄中,這肯定不是我們想要的。
進(jìn)行配置:
在<build>?<resources> 中新增
<resource>
? <directory>src/main/webapp</directory>
? <targetPath>${project.build.directory}/項(xiàng)目名/
</resource>
這里的項(xiàng)目名指的是 target下build產(chǎn)生的文件名稱
解釋名稱:????targetPath 輸出到target的路徑
? ? ? ? ? ? ? ? ? ? ? directory 項(xiàng)目中文件的路徑