If using spring, the below example serves to bring in properties
auto-magically based on a the APP_NAME (ex: /etc/MYAPP or for developers
${user.home}/APPNAME - there are a couple tricks to get this working in
a CI (ie: Jenkins) environment ) set as an environment variable. Then
the system admins maintain the configuration just as is done for all the
other applications (ex: with chef or puppet). If not using Spring, a
utility class can be setup to read the .properties files. With log4j,
look at the config class "PropertyConfigurator" or a similar one for
log4j.xml configuration files.
Hope this helps out - hanasaki
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="beanPlaceholder"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:${APP_NAME}/rdbms-connection.properties</value> <--
substitute with your appname
</list>
</property>
<property name="ignoreResourceNotFound" value="true" />
<property name="ignoreUnresolvablePlaceholders" value="false" />
<property name="searchSystemEnvironment" value="true" />
<property name="systemPropertiesModeName"
value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
</bean>
</beans>
ref:
http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PropertyConfigurator.html#configure%28java.io.InputStream%29
-------- Original Message --------
Subject: Re: externalize conf files
From: Ron Wheeler
To: [email protected]
Date: 11/25/2012 07:21 AM
> https://maven.apache.org/plugins/maven-assembly-plugin/
> http://maven.apache.org/plugins/maven-shade-plugin/
>
>
> On 24/11/2012 5:41 PM, laudio.info wrote:
>> thanks
>> do you have any example or url for read it?
>> thanks
>>
>>
>> 2012/11/24 Ron Wheeler <[email protected]>
>>
>>> On 24/11/2012 5:29 PM, laudio.info wrote:
>>>
>>>> hello
>>>> into my maven projects i have the conf files (properties) and log
>>>> configuracion files into the jars or ears.
>>>> well i must to externalize them.
>>>> i must to put into one external location but i dont know.
>>>> for example i must to put when i install the app (mvn install) into one
>>>> ourt directory, for example c:/confiles
>>>>
>>>> is this posible using maven?
>>>> how?
>>>> can you help me please?
>>>>
>>>> Thanks
>>>>
>>>> There may be other ways to approach this but my first thought
>>>> would be
>>> to have a small assembly project that used the assembly or shade
>>> plug-in to
>>> put these resources into a zip file (or some other archive) that
>>> could be
>>> used to load them into the external location.
>>>
>>> Ron
>>>
>>> --
>>> Ron Wheeler
>>> President
>>> Artifact Software Inc
>>> email: [email protected]
>>> skype: ronaldmwheeler
>>> phone: 866-970-2435, ext 102
>>>
>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]