打war包copy文件之maven-war-plugin

 1 <plugin>
 2     <groupId>org.apache.maven.plugins</groupId>
 3     <artifactId>maven-war-plugin</artifactId>
 4     <version>2.1.1</version>
 5     <configuration>
 6       <webResources>
 7         <resource>
 8           <directory>${basedir}/DB</directory>
 9           <targetPath>/DB</targetPath>
10         </resource>
11       </webResources>
12     </configuration>
13 </plugin>    

  另一种方法如下,文件上传的位置会在class目录下

<build>
  <resources>
    <resource>
      <directory>../DB</directory>
      <targetPath>/DB</targetPath>
    <resource>
  </resources>
</build>

 

posted @ 2022-03-16 16:07  疯靡  阅读(155)  评论(0)    收藏  举报