When running tests in maven it's common usage to have configuration files that should be filtered.
When filtering "normal" resources the syntax is the following :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<!--xml version="1.0" encoding="UTF-8"?--> < project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > ... < build > < resources > < resource > < directory >${project.basedir}/src/main/resources</ directory > < filtering >true</ filtering > </ resource > </ resources > ... </ build > </ project > |
Whereas when filtering test resources the syntax is following :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!--xml version="1.0" encoding="UTF-8"?--> < project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > ... < build > < testresources > < testresource > < directory >${project.basedir}/src/test/resources</ directory > < filtering >true</ filtering > </ testresource > </ testresources > ... </ build > </ project > |
Otherwise your test resources will not be filtered
This comment has been removed by the author.
ReplyDeleteSome mistakes (typo) in the tags :
ReplyDeleteIn place of 'testresources' you should write 'testResources'
In place of 'testresource' you should write 'testResource'
Thanks !