In pom.xml I have defined :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xml</nonFilteredFileExtension>
</nonFilteredFileExtensions>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
and
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
Now the problem is all xml files are not filtered. Is there any possible way to filter single xml file?
I don't know why Gabor's solution did not work, but I managed to solve this way:
Firstly I removed nonFilteredFileExtension tag:
<nonFilteredFileExtension>xml</nonFilteredFileExtension>
Then modified my resources this way:
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/myxml.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
Now my single xml file is filtered and other is leaved untouched by filter.
Something like this works fine for me:
<resources>
<resource>
<directory>src/test/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
<includes>
<include>my_file.xml</include>
</includes>
</resource>
</resources>
This documentation helps me: Apache Maven - Filtering
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With