今天在打包的時候,發現傳上去的包裏沒有配置靜態資源。java
(右鍵項目---》Run As ---> 8 Maven install )ui
後來發現是由於在pom.xml裏沒有配置打包靜態資源的。spa
<resources>給出各個資源在Maven項目中的具體路徑。code
<build> <finalName>project</finalName> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> <include>**/*.tld</include> </includes> <filtering>true</filtering> </resource> </resources> </build>
finalName:構建的最終結果的名字,
directory:資源文件的路徑,
includes:一組文件名的匹配模式,被匹配的資源文件將被構建過程處理
filtering:構建過程當中是否對資源進行過濾,默認false