Maven 2 如何使用maven war插件从目标目录中排除文件/目录?
我按照说明操作,但只有当它被映射到默认目录以外的目录时,它才起作用 以下是我尝试过的一个示例:Maven 2 如何使用maven war插件从目标目录中排除文件/目录?,maven-2,jetty,maven-plugin,pom.xml,war-filedeployment,Maven 2,Jetty,Maven Plugin,Pom.xml,War Filedeployment,我按照说明操作,但只有当它被映射到默认目录以外的目录时,它才起作用 以下是我尝试过的一个示例: <configuration> <webResources> <resource> <directory>${basedir}/src/main/webapp/WEB-INF</directory> <!-- the below works when
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<!-- the below works when uncommented and does exclude *.tmp -->
<!-- <targetPath>test/WEB-INF</targetPath> -->
<!-- the below does not -->
<targetPath>WEB-INF</targetPath>
<excludes>
<exclude>*.tmp</exclude>
</excludes>
</resource>
</webResources>
</configuration>
${basedir}/src/main/webapp/WEB-INF
WEB-INF
*.tmp
因此,我的假设是,我有其他东西覆盖配置。然而,这是我第一个使用maven的项目,所以我不确定下一步要测试或研究什么。将排除更改为
**/*.tmp
您还可以从目录中删除WEB-INF,并完全删除targetDirectory。例如,这里有一个将包括所有xml、xhtml、x*ml等,并排除任何目录中的所有*.tmp
<webResources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<includes>
<include>**/*.x*ml</include>
</includes>
<excludes>
<exclude>**/*.tmp</exclude>
</excludes>
</resource>
</webResources>
${basedir}/src/main/webapp
**/*.x*ml
**/*.tmp
将您的排除更改为
**/*.tmp
您还可以从目录中删除WEB-INF,并完全删除targetDirectory。例如,这里有一个将包括所有xml、xhtml、x*ml等,并排除任何目录中的所有*.tmp
<webResources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<includes>
<include>**/*.x*ml</include>
</includes>
<excludes>
<exclude>**/*.tmp</exclude>
</excludes>
</resource>
</webResources>
${basedir}/src/main/webapp
**/*.x*ml
**/*.tmp