You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "laudio.info" <la...@gmail.com> on 2012/11/24 23:29:00 UTC

externalize conf files

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

Re: externalize conf files

Posted by hanasaki <ha...@hanaden.com>.
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: users@maven.apache.org
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 <rw...@artifact-software.com>
>>
>>> 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: rwheeler@artifact-software.com
>>> skype: ronaldmwheeler
>>> phone: 866-970-2435, ext 102
>>>
>>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: externalize conf files

Posted by Ron Wheeler <rw...@artifact-software.com>.
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 <rw...@artifact-software.com>
>
>> 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: rwheeler@artifact-software.com
>> skype: ronaldmwheeler
>> phone: 866-970-2435, ext 102
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: externalize conf files

Posted by "laudio.info" <la...@gmail.com>.
thanks
do you have any example or url for read it?
thanks


2012/11/24 Ron Wheeler <rw...@artifact-software.com>

> 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: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: externalize conf files

Posted by Ron Wheeler <rw...@artifact-software.com>.
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: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: externalize conf files

Posted by Aliaksei Lahachou <al...@gmail.com>.
Hello,

I'm not sure what exactly you need, but here's a couple of guesses:

1. If you want to copy files from the project to another location, you may
try resources:copy-resources [1].
2. If you need to load properties from properties file, you may try
build-configurator-maven-plugin [2].

[1]
http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
[2]
http://htfv.github.com/build-configurator/1.0.0/loading-property-files.html


Regards,
htfv (Aliaksei Lahachou)


On Sat, Nov 24, 2012 at 11:29 PM, laudio.info <la...@gmail.com> 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
>