I'm running into the exact same problem. I'd be really convenient to be able to keep the same properties name.
Could someone confirm this is a problem or the expected behavior? Is there any workaround? apart from renaming properties? cheers -nodje rundmsef wrote: > > > If you are attempting to filter resources in src/main and src/test, > there are a few "gotchas" to look out for. Generally, the format of your > pom.xml should be as follows: > > // START POM.XML SNIPPET // > > <project> > > <build> > > <!-- Filter resources --> > <filters> > <filter>src/main/filters/<your_filter_file>.properties</filter> > <filter>src/test/filters/<your_filter_file>.properties</filter> > </filters> > > <!-- Resources for src/main --> > <resources> > <resource> > <directory>src/main/resources</directory> > <filtering>true</filtering> > </resource> > </resources> > > <!-- Resources for src/test --> > <testResources> > <testResource> > <directory>src/test/resources</directory> > <filtering>true</filtering> > </testResource> > </testResources> > > </build> > > </project> > > // END POM.XML SNIPPET // > > Here's the big GOTCHA: The POM.xml file only has one <filters> section, > which get APPLIED TO ALL RESOURCES. Therefore, if you have a src/main and > a src/test filter.properties file that have duplicate properties with > different values, they will conflict with one another. > > Ideally, there would be some sort of way to specify <filters> and > <testFilters>. I'm a bit surprised this is not the case, since Maven > usually applies sensible defaults. > > I got around this issues by making sure the properties in my test and main > filter.properties files were named differently. For example: > > # src/main/database.properties > db.username=myUsername > db.password=myPassword > > # src/main/database-test.properties > db.test.username=myTestUsername > db.test.password=myTestPassword > > > In this case, db.username will not conflict with db.test.username. Now > just make sure your resource files refer to the correct properties and > you'll be good to go! > > I hope this saves somebody some time. I know it took me a while to figure > out! > > > -- View this message in context: http://www.nabble.com/Filtering-TestResources-tp18507921p20299692.html Sent from the Maven - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
