Re: Filtering TestResources

2008-11-13 Thread Olivier Lamy
2008/11/13 nodje [EMAIL PROTECTED]:

 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 [EMAIL PROTECTED]:

 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

 filtersrc/main/filters/your_filter_file.properties/filter

 filtersrc/test/filters/your_filter_file.properties/filter
 /filters

 !-- Resources for src/main --
 resources
 resource
 directorysrc/main/resources/directory
 filteringtrue/filtering
 /resource
 /resources

 !-- Resources for src/test --
 testResources
 testResource
 directorysrc/test/resources/directory
 filteringtrue/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

Re: Filtering TestResources

2008-11-12 Thread nodje

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

 filtersrc/main/filters/your_filter_file.properties/filter

 filtersrc/test/filters/your_filter_file.properties/filter
 /filters

 !-- Resources for src/main --
 resources
 resource
 directorysrc/main/resources/directory
 filteringtrue/filtering
 /resource
 /resources

 !-- Resources for src/test --
 testResources
 testResource
 directorysrc/test/resources/directory
 filteringtrue/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]



Re: Filtering TestResources

2008-11-12 Thread nodje

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 [EMAIL PROTECTED]:

 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

 filtersrc/main/filters/your_filter_file.properties/filter

 filtersrc/test/filters/your_filter_file.properties/filter
 /filters

 !-- Resources for src/main --
 resources
 resource
 directorysrc/main/resources/directory
 filteringtrue/filtering
 /resource
 /resources

 !-- Resources for src/test --
 testResources
 testResource
 directorysrc/test/resources/directory
 filteringtrue/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

Re: Filtering TestResources

2008-11-03 Thread nodje

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
 filtersrc/main/filters/your_filter_file.properties/filter
 filtersrc/test/filters/your_filter_file.properties/filter
 /filters
 
 !-- Resources for src/main --
 resources
 resource
 directorysrc/main/resources/directory
 filteringtrue/filtering
 /resource
 /resources
 
 !-- Resources for src/test --
 testResources
 testResource
 directorysrc/test/resources/directory
 filteringtrue/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]



Re: Filtering TestResources

2008-11-03 Thread Olivier Lamy
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
 filtersrc/main/filters/your_filter_file.properties/filter
 filtersrc/test/filters/your_filter_file.properties/filter
 /filters

 !-- Resources for src/main --
 resources
 resource
 directorysrc/main/resources/directory
 filteringtrue/filtering
 /resource
 /resources

 !-- Resources for src/test --
 testResources
 testResource
 directorysrc/test/resources/directory
 filteringtrue/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]



Re: Filtering TestResources

2008-11-03 Thread nodje

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
 filtersrc/main/filters/your_filter_file.properties/filter
 filtersrc/test/filters/your_filter_file.properties/filter
 /filters

 !-- Resources for src/main --
 resources
 resource
 directorysrc/main/resources/directory
 filteringtrue/filtering
 /resource
 /resources

 !-- Resources for src/test --
 testResources
 testResource
 directorysrc/test/resources/directory
 filteringtrue/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]



Re: Filtering TestResources

2008-11-03 Thread Olivier Lamy
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
 filtersrc/main/filters/your_filter_file.properties/filter
 filtersrc/test/filters/your_filter_file.properties/filter
 /filters

 !-- Resources for src/main --
 resources
 resource
 directorysrc/main/resources/directory
 filteringtrue/filtering
 /resource
 /resources

 !-- Resources for src/test --
 testResources
 testResource
 directorysrc/test/resources/directory
 filteringtrue/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]



Filtering TestResources

2008-07-17 Thread rundmsef


  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
filtersrc/main/filters/your_filter_file.properties/filter
filtersrc/test/filters/your_filter_file.properties/filter
/filters

!-- Resources for src/main --
resources
resource
directorysrc/main/resources/directory
filteringtrue/filtering
/resource
/resources

!-- Resources for src/test --
testResources
testResource
directorysrc/test/resources/directory
filteringtrue/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-tp18507921p18507921.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]