You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Anastasios Angelidis <vo...@videotron.ca> on 2009/04/22 17:20:14 UTC

Sharing properties between modules

Is there any good samples out there showing how to share properties 
between multiple modules?

I.e:

Parent POM
    Module1
    Module2

Basically both module share common database connection properties so 
instead of filtering in both, I would like to filter on the parent and 
propagate to the children. But also would like to be able to to do so on 
per module basis.

So I should be able to build the entire project or the individual modules.

Thanks



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


RE: Sharing properties between modules

Posted by Todd Thiessen <th...@nortel.com>.
> So any good samples anywhere?

Regarding profiles? Yes. The definitive guide is a good place to start.

http://www.sonatype.com/books/maven-book/reference/profiles.html

I would recommend looking through the entire book and keep a link to it
handy ;-).

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


Re: Sharing properties between modules

Posted by Anastasios Angelidis <vo...@videotron.ca>.
lol I know about profiles and I'm using them. I'm just trying to picture 
how I would everything together...

So if I understand correctly...

I create profile called module 1
I create profile called module 2

And in the parent I activate both?
And while building individual, I activate one or the other?


Stephen Connolly wrote:
> http://www.lmgtfy.com/?q=maven+profile+activation
>
> 2009/4/23 Anastasios Angelidis <vo...@videotron.ca>
>
>   
>> So any good samples anywhere?
>>
>>
>> Stephen Connolly wrote:
>>
>>     
>>> hmmm
>>>
>>> I suspect that what you'd need is profiles
>>>
>>> you could activate a profilein the child if the file is present
>>>
>>> On 22/04/2009, Anastasios Angelidis <vo...@videotron.ca> wrote:
>>>
>>>
>>>       
>>>> I guess if that's what you call them lol
>>>>
>>>> So yes if the .properties file is in the parent then use that one. If
>>>> it's in the child module use the child one.
>>>>
>>>>
>>>> Stephen Connolly wrote:
>>>>
>>>>
>>>>         
>>>>> Ahhhh
>>>>>
>>>>> you want to use the value from the parent if the parent is in the
>>>>> current
>>>>> reactor but if the parent is not in the current reactor, you want to use
>>>>> the
>>>>> value from the child?
>>>>>
>>>>> Is that what you are trying to do?
>>>>>
>>>>> -Stephen
>>>>>
>>>>> 2009/4/22 Anastasios Angelidis <vo...@videotron.ca>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>>> Sometime we build the entire project sometimes just individual modules.
>>>>>>
>>>>>> Each module has it's own filters right now.
>>>>>>
>>>>>> Basically if the parent filter exists then use that one. If only
>>>>>> building
>>>>>> an individual module then use it's filter.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Grant Rettke wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> And each individual module should have filtering on right?
>>>>>>>
>>>>>>>          If you want to share them, what would you be filtering out?
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
>   


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


Re: Sharing properties between modules

Posted by Stephen Connolly <st...@gmail.com>.
http://www.lmgtfy.com/?q=maven+profile+activation

2009/4/23 Anastasios Angelidis <vo...@videotron.ca>

> So any good samples anywhere?
>
>
> Stephen Connolly wrote:
>
>> hmmm
>>
>> I suspect that what you'd need is profiles
>>
>> you could activate a profilein the child if the file is present
>>
>> On 22/04/2009, Anastasios Angelidis <vo...@videotron.ca> wrote:
>>
>>
>>> I guess if that's what you call them lol
>>>
>>> So yes if the .properties file is in the parent then use that one. If
>>> it's in the child module use the child one.
>>>
>>>
>>> Stephen Connolly wrote:
>>>
>>>
>>>> Ahhhh
>>>>
>>>> you want to use the value from the parent if the parent is in the
>>>> current
>>>> reactor but if the parent is not in the current reactor, you want to use
>>>> the
>>>> value from the child?
>>>>
>>>> Is that what you are trying to do?
>>>>
>>>> -Stephen
>>>>
>>>> 2009/4/22 Anastasios Angelidis <vo...@videotron.ca>
>>>>
>>>>
>>>>
>>>>
>>>>> Sometime we build the entire project sometimes just individual modules.
>>>>>
>>>>> Each module has it's own filters right now.
>>>>>
>>>>> Basically if the parent filter exists then use that one. If only
>>>>> building
>>>>> an individual module then use it's filter.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Grant Rettke wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> And each individual module should have filtering on right?
>>>>>>
>>>>>>          If you want to share them, what would you be filtering out?
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Sharing properties between modules

Posted by Anastasios Angelidis <vo...@videotron.ca>.
So any good samples anywhere?

Stephen Connolly wrote:
> hmmm
>
> I suspect that what you'd need is profiles
>
> you could activate a profilein the child if the file is present
>
> On 22/04/2009, Anastasios Angelidis <vo...@videotron.ca> wrote:
>   
>> I guess if that's what you call them lol
>>
>> So yes if the .properties file is in the parent then use that one. If
>> it's in the child module use the child one.
>>
>>
>> Stephen Connolly wrote:
>>     
>>> Ahhhh
>>>
>>> you want to use the value from the parent if the parent is in the current
>>> reactor but if the parent is not in the current reactor, you want to use
>>> the
>>> value from the child?
>>>
>>> Is that what you are trying to do?
>>>
>>> -Stephen
>>>
>>> 2009/4/22 Anastasios Angelidis <vo...@videotron.ca>
>>>
>>>
>>>       
>>>> Sometime we build the entire project sometimes just individual modules.
>>>>
>>>> Each module has it's own filters right now.
>>>>
>>>> Basically if the parent filter exists then use that one. If only building
>>>> an individual module then use it's filter.
>>>>
>>>>
>>>>
>>>>
>>>> Grant Rettke wrote:
>>>>
>>>>
>>>>         
>>>>> And each individual module should have filtering on right?
>>>>>
>>>>>           
>>>>> If you want to share them, what would you be filtering out?
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>>         
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>   


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


Re: Sharing properties between modules

Posted by Stephen Connolly <st...@gmail.com>.
hmmm

I suspect that what you'd need is profiles

you could activate a profilein the child if the file is present

On 22/04/2009, Anastasios Angelidis <vo...@videotron.ca> wrote:
> I guess if that's what you call them lol
>
> So yes if the .properties file is in the parent then use that one. If
> it's in the child module use the child one.
>
>
> Stephen Connolly wrote:
>> Ahhhh
>>
>> you want to use the value from the parent if the parent is in the current
>> reactor but if the parent is not in the current reactor, you want to use
>> the
>> value from the child?
>>
>> Is that what you are trying to do?
>>
>> -Stephen
>>
>> 2009/4/22 Anastasios Angelidis <vo...@videotron.ca>
>>
>>
>>> Sometime we build the entire project sometimes just individual modules.
>>>
>>> Each module has it's own filters right now.
>>>
>>> Basically if the parent filter exists then use that one. If only building
>>> an individual module then use it's filter.
>>>
>>>
>>>
>>>
>>> Grant Rettke wrote:
>>>
>>>
>>>> And each individual module should have filtering on right?
>>>>
>>>>>
>>>> If you want to share them, what would you be filtering out?
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Sharing properties between modules

Posted by Anastasios Angelidis <vo...@videotron.ca>.
I guess if that's what you call them lol

So yes if the .properties file is in the parent then use that one. If 
it's in the child module use the child one.


Stephen Connolly wrote:
> Ahhhh
>
> you want to use the value from the parent if the parent is in the current
> reactor but if the parent is not in the current reactor, you want to use the
> value from the child?
>
> Is that what you are trying to do?
>
> -Stephen
>
> 2009/4/22 Anastasios Angelidis <vo...@videotron.ca>
>
>   
>> Sometime we build the entire project sometimes just individual modules.
>>
>> Each module has it's own filters right now.
>>
>> Basically if the parent filter exists then use that one. If only building
>> an individual module then use it's filter.
>>
>>
>>
>>
>> Grant Rettke wrote:
>>
>>     
>>> And each individual module should have filtering on right?
>>>       
>>>>         
>>> If you want to share them, what would you be filtering out?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
>   


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


Re: Sharing properties between modules

Posted by Stephen Connolly <st...@gmail.com>.
Ahhhh

you want to use the value from the parent if the parent is in the current
reactor but if the parent is not in the current reactor, you want to use the
value from the child?

Is that what you are trying to do?

-Stephen

2009/4/22 Anastasios Angelidis <vo...@videotron.ca>

> Sometime we build the entire project sometimes just individual modules.
>
> Each module has it's own filters right now.
>
> Basically if the parent filter exists then use that one. If only building
> an individual module then use it's filter.
>
>
>
>
> Grant Rettke wrote:
>
>> And each individual module should have filtering on right?
>>>
>>>
>>
>> If you want to share them, what would you be filtering out?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Sharing properties between modules

Posted by Anastasios Angelidis <vo...@videotron.ca>.
Sometime we build the entire project sometimes just individual modules.

Each module has it's own filters right now.

Basically if the parent filter exists then use that one. If only 
building an individual module then use it's filter.



Grant Rettke wrote:
>> And each individual module should have filtering on right?
>>     
>
> If you want to share them, what would you be filtering out?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>   


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


Re: Sharing properties between modules

Posted by Grant Rettke <gr...@acm.org>.
> And each individual module should have filtering on right?

If you want to share them, what would you be filtering out?

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


Re: Sharing properties between modules

Posted by Anastasios Angelidis <vo...@videotron.ca>.
And each individual module should have filtering on right?



David Hoffer wrote:
> You can set any number of properties in the parent, that all the modules
> inherit.
>
> <properties>
>         <prop1>value</prop1>
>         <prop2>value</prop2>
> </properties>
>
>
> On Wed, Apr 22, 2009 at 9:20 AM, Anastasios Angelidis
> <vo...@videotron.ca>wrote:
>
>   
>> Is there any good samples out there showing how to share properties between
>> multiple modules?
>>
>> I.e:
>>
>> Parent POM
>>   Module1
>>   Module2
>>
>> Basically both module share common database connection properties so
>> instead of filtering in both, I would like to filter on the parent and
>> propagate to the children. But also would like to be able to to do so on per
>> module basis.
>>
>> So I should be able to build the entire project or the individual modules.
>>
>> Thanks
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
>   


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


Re: Sharing properties between modules

Posted by David Hoffer <dh...@gmail.com>.
You can set any number of properties in the parent, that all the modules
inherit.

<properties>
        <prop1>value</prop1>
        <prop2>value</prop2>
</properties>


On Wed, Apr 22, 2009 at 9:20 AM, Anastasios Angelidis
<vo...@videotron.ca>wrote:

> Is there any good samples out there showing how to share properties between
> multiple modules?
>
> I.e:
>
> Parent POM
>   Module1
>   Module2
>
> Basically both module share common database connection properties so
> instead of filtering in both, I would like to filter on the parent and
> propagate to the children. But also would like to be able to to do so on per
> module basis.
>
> So I should be able to build the entire project or the individual modules.
>
> Thanks
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>