Profiles, filtering resources and optional content
Hello everyone, I would like to have one configuration file in properties format. Configuration differs in some parts between prod and dev profiles. For example: conf.properties for prod env: keyA=valueAP keyB=valueBP keyC=valueCP conf.properties for dev env: keyA=valueAD keyB=valueBD keyC=valueCD keyD=valueDD keyE=valueED I would change it with use of profiles and filtering to one conf.properties file like this: conf.properties: keyA=${keyAvalueA} keyB=${keyAvalueB} keyC=${keyAvalueC} filter.properties for prod would look like this: keyAvalue=valueAP keyBvalue=valueBP keyCvalue=valueCP But what to do with values which must be in dev version and must not be in prod version (keyD and keyE)? Add in conf.properties something like ${dev.settings} in the end of file and in filter.properties for dev with: dev.settings=... where . is encoded: keyD=valueDD keyE=valueED as a value of dev.settings property? Any cleaner and more readable solution? Thanks and regards, Piotr -- View this message in context: http://www.nabble.com/Profiles%2C-filtering-resources-and-optional-content-tf3402841s177.html#a9476847 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: Profiles, filtering resources and optional content
Hi, Mark Hobson wrote: An alternative to filtering the same resource is to split it into two and profile it. So you'd move src/main/resources/conf.properties to, say: * src/main/profiles/prod/resources/conf.properties * src/main/profiles/dev/resources/conf.properties Actually, I thought about this solution but unfortunately the common part of the conf.properties is so big that I would not like to keep it in two separate places and need to remember to change these common parts in two (or even more if I will need more profiles) files. Thanks and regards, Piotr -- View this message in context: http://www.nabble.com/Profiles%2C-filtering-resources-and-optional-content-tf3402841s177.html#a9477378 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: Profiles, filtering resources and optional content
An alternative to filtering the same resource is to split it into two and profile it. So you'd move src/main/resources/conf.properties to, say: * src/main/profiles/prod/resources/conf.properties * src/main/profiles/dev/resources/conf.properties Configure the profiles in your POM accordingly, and then you've got full control of the content of the file under each profile. Mark On 14/03/07, Piotr Bzdyl [EMAIL PROTECTED] wrote: Hello everyone, I would like to have one configuration file in properties format. Configuration differs in some parts between prod and dev profiles. For example: conf.properties for prod env: keyA=valueAP keyB=valueBP keyC=valueCP conf.properties for dev env: keyA=valueAD keyB=valueBD keyC=valueCD keyD=valueDD keyE=valueED I would change it with use of profiles and filtering to one conf.properties file like this: conf.properties: keyA=${keyAvalueA} keyB=${keyAvalueB} keyC=${keyAvalueC} filter.properties for prod would look like this: keyAvalue=valueAP keyBvalue=valueBP keyCvalue=valueCP But what to do with values which must be in dev version and must not be in prod version (keyD and keyE)? Add in conf.properties something like ${dev.settings} in the end of file and in filter.properties for dev with: dev.settings=... where . is encoded: keyD=valueDD keyE=valueED as a value of dev.settings property? Any cleaner and more readable solution? Thanks and regards, Piotr -- View this message in context: http://www.nabble.com/Profiles%2C-filtering-resources-and-optional-content-tf3402841s177.html#a9476847 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: Profiles, filtering resources and optional content
On 14/03/07, Piotr Bzdyl [EMAIL PROTECTED] wrote: Actually, I thought about this solution but unfortunately the common part of the conf.properties is so big that I would not like to keep it in two separate places and need to remember to change these common parts in two (or even more if I will need more profiles) files. Yeah, that is the drawback. I guess the general rule of thumb is: if resources differ between profiles greatly, then profile them; otherwise filter them. So in your case I'd create filters that expand to multiple properties like you suggested. Although I'd be interested in any alternatives others may have..? Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]