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 <[EMAIL PROTECTED]>:
>>
>> 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 <[EMAIL PROTECTED]>:
>>>>
>>>> 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]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> 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: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to