我有一个SpringMVC WebApp,它有文件上传系统。 问题是每当我重建项目时,myproject / src / main / webapp / resources / uploads中的所有文件都会消失。
我有什么想法可以修改这个? 我试图寻找一种方法来保护该文件夹但却无法使其发挥作用。
我尝试过POM.xml:
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
....
<!-- <webResources> -->
<!-- <resource> -->
<!-- this is relative to the pom.xml directory -->
<!-- <directory>src/main/webapp/resources/uploads</directory> -->
<!-- there's no default value for this -->
<!-- </resource> -->
<!-- </webResources> -->
<webResources>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**</exclude>
</excludes>
<excludes>
<exclude>src/main/resources/**</exclude>
</excludes>
<excludes>
<exclude>src/main/webapp/resources/**</exclude>
</excludes>
</resource>
</resources>
</webResources>
<packagingExcludes>
WEB-INF/../resources/,
resources/,
resources/uploads/,
WEB-INF/classes/uploads/**,
WEB-INF/classes/**
</packagingExcludes>
</configuration>
</plugin>
答案 0 :(得分:0)
如果您想在构建时在war文件中包含相同内容,请查看以下链接: