我有一个带有文件src/main/webapp/META-INF/context.xml的Web应用程序,其中包含一些用于测试数据库的配置.在生产服务器上,此文件位于$ TOMCAT_HOME/conf/Catalina/localhost/ROOT.xml中,我正在使用嵌入式tomcat进行测试,因此我不想打包此文件.我想从maven build中排除这个文件.我试过以下:
<build>
...
<resources>
<resource>
<directory>src/main/webapp/META-INF</directory>
<filtering>true</filtering>
<excludes>
<exclude>context.xml</exclude>
</excludes>
</resource>
</resources>
</build>
Run Code Online (Sandbox Code Playgroud)
以及:
<build>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<resources>
<resource>
<directory>src/main/webapp/META-INF</directory>
<filtering>true</filtering>
<excludes>
<exclude>context.xml</exclude>
</excludes>
</resource>
</resources>
</configuration>
</plugin>
</build>
Run Code Online (Sandbox Code Playgroud)
但是文件仍然在war和build目录中打包(例如target/myapp-1.0-SNAPSHOT/META-INF/context.xml).我究竟做错了什么?
maven ×2