You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by nodje <no...@gmail.com> on 2008/11/03 10:36:42 UTC
Re: Filtering TestResources
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Filtering TestResources
Posted by Olivier Lamy <ol...@apache.org>.
2008/11/13 nodje <no...@gmail.com>:
>
> Is http://jira.codehaus.org/browse/MRESOURCES the right place to submit the
> issue?
Yes
>
> As for the test case, what about a pom.xml with the minimal directory
> structure and a couple of properties files and filters. Can I update that on
> Jira?
Yes (If you could add a description with the expected values in the
filtered resources : we can write an IT Test with that)
>
> -nodje
>
>
> Olivier Lamy wrote:
>>
>> Can you load an issue and provide a project test case ?
>>
>> Thanks,
>> --
>> Olivier
>>
>> 2008/11/12 nodje <no...@gmail.com>:
>>>
>>> Hi,
>>>
>>> it seemed to work at first, but now we get the main/resources filtered by
>>> the test/filters.
>>> We have to revert on naming properties differently :(
>>>
>>> -nodje
>>>
>>>
>>> Olivier Lamy wrote:
>>>>
>>>> Hi,
>>>> As we have an it test [1] which test this and works, it should :-)
>>>>
>>>> --
>>>> Olivier
>>>> [1]
>>>> https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-resources-plugin/src/it/filter-test-resources/
>>>>
>>>>
>>>> 2008/11/4 nodje <no...@gmail.com>:
>>>>>
>>>>> Good question actually.
>>>>> I realize I don't even specify it in my pom, I took for granted it was
>>>>> included with the Maven default config. Which, when looking at the
>>>>> Maven
>>>>> super pom, it is not. It's only specified in the <pluginManagement>
>>>>> section
>>>>> and with version 2.2. As I understand <pluginManagement> it should only
>>>>> specify the default version to use when you include the plugin in your
>>>>> pom
>>>>> and not add the plugin to each every Maven project. But it seems it
>>>>> does.
>>>>>
>>>>> I'm gonna try the 2.3 version then. Is it supposed to work with this
>>>>> one?
>>>>>
>>>>> -nodje
>>>>>
>>>>>
>>>>> olamy wrote:
>>>>>>
>>>>>> Hi,
>>>>>> Which version of the resources plugin are you using ?
>>>>>>
>>>>>> --
>>>>>> Olivier
>>>>>>
>>>>>> 2008/11/3 nodje <no...@gmail.com>:
>>>>>>>
>>>>>>> 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: users-unsubscribe@maven.apache.org
>>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Filtering-TestResources-tp18507921p20315977.html
>>>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Filtering-TestResources-tp18507921p20458440.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Filtering-TestResources-tp18507921p20472870.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Filtering TestResources
Posted by nodje <no...@gmail.com>.
Is http://jira.codehaus.org/browse/MRESOURCES the right place to submit the
issue?
As for the test case, what about a pom.xml with the minimal directory
structure and a couple of properties files and filters. Can I update that on
Jira?
-nodje
Olivier Lamy wrote:
>
> Can you load an issue and provide a project test case ?
>
> Thanks,
> --
> Olivier
>
> 2008/11/12 nodje <no...@gmail.com>:
>>
>> Hi,
>>
>> it seemed to work at first, but now we get the main/resources filtered by
>> the test/filters.
>> We have to revert on naming properties differently :(
>>
>> -nodje
>>
>>
>> Olivier Lamy wrote:
>>>
>>> Hi,
>>> As we have an it test [1] which test this and works, it should :-)
>>>
>>> --
>>> Olivier
>>> [1]
>>> https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-resources-plugin/src/it/filter-test-resources/
>>>
>>>
>>> 2008/11/4 nodje <no...@gmail.com>:
>>>>
>>>> Good question actually.
>>>> I realize I don't even specify it in my pom, I took for granted it was
>>>> included with the Maven default config. Which, when looking at the
>>>> Maven
>>>> super pom, it is not. It's only specified in the <pluginManagement>
>>>> section
>>>> and with version 2.2. As I understand <pluginManagement> it should only
>>>> specify the default version to use when you include the plugin in your
>>>> pom
>>>> and not add the plugin to each every Maven project. But it seems it
>>>> does.
>>>>
>>>> I'm gonna try the 2.3 version then. Is it supposed to work with this
>>>> one?
>>>>
>>>> -nodje
>>>>
>>>>
>>>> olamy wrote:
>>>>>
>>>>> Hi,
>>>>> Which version of the resources plugin are you using ?
>>>>>
>>>>> --
>>>>> Olivier
>>>>>
>>>>> 2008/11/3 nodje <no...@gmail.com>:
>>>>>>
>>>>>> 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: users-unsubscribe@maven.apache.org
>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Filtering-TestResources-tp18507921p20315977.html
>>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Filtering-TestResources-tp18507921p20458440.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Filtering-TestResources-tp18507921p20472870.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Filtering TestResources
Posted by Olivier Lamy <ol...@apache.org>.
Can you load an issue and provide a project test case ?
Thanks,
--
Olivier
2008/11/12 nodje <no...@gmail.com>:
>
> Hi,
>
> it seemed to work at first, but now we get the main/resources filtered by
> the test/filters.
> We have to revert on naming properties differently :(
>
> -nodje
>
>
> Olivier Lamy wrote:
>>
>> Hi,
>> As we have an it test [1] which test this and works, it should :-)
>>
>> --
>> Olivier
>> [1]
>> https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-resources-plugin/src/it/filter-test-resources/
>>
>>
>> 2008/11/4 nodje <no...@gmail.com>:
>>>
>>> Good question actually.
>>> I realize I don't even specify it in my pom, I took for granted it was
>>> included with the Maven default config. Which, when looking at the Maven
>>> super pom, it is not. It's only specified in the <pluginManagement>
>>> section
>>> and with version 2.2. As I understand <pluginManagement> it should only
>>> specify the default version to use when you include the plugin in your
>>> pom
>>> and not add the plugin to each every Maven project. But it seems it does.
>>>
>>> I'm gonna try the 2.3 version then. Is it supposed to work with this one?
>>>
>>> -nodje
>>>
>>>
>>> olamy wrote:
>>>>
>>>> Hi,
>>>> Which version of the resources plugin are you using ?
>>>>
>>>> --
>>>> Olivier
>>>>
>>>> 2008/11/3 nodje <no...@gmail.com>:
>>>>>
>>>>> 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: users-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Filtering-TestResources-tp18507921p20315977.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Filtering-TestResources-tp18507921p20458440.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Filtering TestResources
Posted by nodje <no...@gmail.com>.
Hi,
it seemed to work at first, but now we get the main/resources filtered by
the test/filters.
We have to revert on naming properties differently :(
-nodje
Olivier Lamy wrote:
>
> Hi,
> As we have an it test [1] which test this and works, it should :-)
>
> --
> Olivier
> [1]
> https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-resources-plugin/src/it/filter-test-resources/
>
>
> 2008/11/4 nodje <no...@gmail.com>:
>>
>> Good question actually.
>> I realize I don't even specify it in my pom, I took for granted it was
>> included with the Maven default config. Which, when looking at the Maven
>> super pom, it is not. It's only specified in the <pluginManagement>
>> section
>> and with version 2.2. As I understand <pluginManagement> it should only
>> specify the default version to use when you include the plugin in your
>> pom
>> and not add the plugin to each every Maven project. But it seems it does.
>>
>> I'm gonna try the 2.3 version then. Is it supposed to work with this one?
>>
>> -nodje
>>
>>
>> olamy wrote:
>>>
>>> Hi,
>>> Which version of the resources plugin are you using ?
>>>
>>> --
>>> Olivier
>>>
>>> 2008/11/3 nodje <no...@gmail.com>:
>>>>
>>>> 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: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Filtering-TestResources-tp18507921p20315977.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Filtering-TestResources-tp18507921p20458440.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Filtering TestResources
Posted by Olivier Lamy <ol...@apache.org>.
Hi,
As we have an it test [1] which test this and works, it should :-)
--
Olivier
[1] https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-resources-plugin/src/it/filter-test-resources/
2008/11/4 nodje <no...@gmail.com>:
>
> Good question actually.
> I realize I don't even specify it in my pom, I took for granted it was
> included with the Maven default config. Which, when looking at the Maven
> super pom, it is not. It's only specified in the <pluginManagement> section
> and with version 2.2. As I understand <pluginManagement> it should only
> specify the default version to use when you include the plugin in your pom
> and not add the plugin to each every Maven project. But it seems it does.
>
> I'm gonna try the 2.3 version then. Is it supposed to work with this one?
>
> -nodje
>
>
> olamy wrote:
>>
>> Hi,
>> Which version of the resources plugin are you using ?
>>
>> --
>> Olivier
>>
>> 2008/11/3 nodje <no...@gmail.com>:
>>>
>>> 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: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Filtering-TestResources-tp18507921p20315977.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Filtering TestResources
Posted by nodje <no...@gmail.com>.
Good question actually.
I realize I don't even specify it in my pom, I took for granted it was
included with the Maven default config. Which, when looking at the Maven
super pom, it is not. It's only specified in the <pluginManagement> section
and with version 2.2. As I understand <pluginManagement> it should only
specify the default version to use when you include the plugin in your pom
and not add the plugin to each every Maven project. But it seems it does.
I'm gonna try the 2.3 version then. Is it supposed to work with this one?
-nodje
olamy wrote:
>
> Hi,
> Which version of the resources plugin are you using ?
>
> --
> Olivier
>
> 2008/11/3 nodje <no...@gmail.com>:
>>
>> 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: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Filtering-TestResources-tp18507921p20315977.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Filtering TestResources
Posted by Olivier Lamy <ol...@apache.org>.
Hi,
Which version of the resources plugin are you using ?
--
Olivier
2008/11/3 nodje <no...@gmail.com>:
>
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org