You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Colin Sampaleanu <co...@exis.com> on 2003/09/19 20:29:47 UTC

Any way to have shared properties when extending from a base project

I just realized that while you can extend a project with something like
   extend>${basedir}/../master/project.xml</extend>
maven doesn't seem to read in build.properties (and project.properties 
either I guess) from the master project. This is a real PITA, as I don't 
want to force people to put identical build.properties files in all the 
subprojects, and it's not acceptible to have a build.properties file in 
the user directory, as it will trample the version for other projects.

I think I'm missing something, as this is a big hole. What are other 
people doing in this situation?

Regards,
Colin



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


Re: Any way to have shared properties when extending from a base project

Posted by khote <kh...@mminternet.com>.
In my subproject maven.xml files I've had to:

  <loadproperties srcFile="../build.properties"/>
  <loadproperties srcFile="../project.properties"/>

Maven loads settings in this order, and uses last set to determine final
value of a property:

${project.home}/project.properties
${project.home}/build.properties
${user.home}/build.properties

Ant on the other hand uses first-set, once a property has a value it can't
be changed.
So getting the loadproperties done in the right order is critical if you're
overriding anything with your build.properties.

THAT is a real PITA, I agree.


----- Original Message ----- 
From: "Colin Sampaleanu" <co...@exis.com>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Friday, September 19, 2003 11:29 AM
Subject: Any way to have shared properties when extending from a base
project


> I just realized that while you can extend a project with something like
>    extend>${basedir}/../master/project.xml</extend>
> maven doesn't seem to read in build.properties (and project.properties
> either I guess) from the master project. This is a real PITA, as I don't
> want to force people to put identical build.properties files in all the
> subprojects, and it's not acceptible to have a build.properties file in
> the user directory, as it will trample the version for other projects.
>
> I think I'm missing something, as this is a big hole. What are other
> people doing in this situation?
>
> Regards,
> Colin
>
>
>
> ---------------------------------------------------------------------
> 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: Any way to have shared properties when extending from a base project

Posted by khote <kh...@mminternet.com>.
I had to write an "init" or even a "pre-init" goal that every goal in my
maven.xml used as a prereqs or an attainGoal

<goal name="pre-init">
do pre-init stuff
</goal>
....

<preGoal name="jar:compile">
  <attainGoal name="pre-init"/>
 ...
</preGoal>

and for my own goals:

<goal name="someGoal" prereqs="preinit">
 ....
</goal>

unfortunately <preGoal> doesn't understand prereqs

----- Original Message ----- 
From: "Colin Sampaleanu" <co...@exis.com>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Friday, September 19, 2003 11:53 AM
Subject: Re: Any way to have shared properties when extending from a base
project


> Actaully, I like your method a bit better, since I want to have a
> top-level build.properties, but still allow a build.properties in the
> project to override that if possible. Since I have a maven.xml in every
> subproject anyways, it's not that big a deal to read in some files there.
>
> Only issue is triggering the read. There used to be a build start goal
> (forgot what the name was) that you could use to attach off of (with a
> postGoal), but it got broken a long long time ago. I forgot the exact
> name. Does anybody know if this goal is still non-existentbroken? I had
> a look in Jira, but couldn't find an issue. Without that goal, it's
> almost impossible to do something at the begining of every build (like
> readin in properties) when you don't know what goal the user will be
> running, so you can do a preGoal off that or one of its dependencies...
>
> Colin
>
> khote wrote:
>
> >this method works?  I'm going to give it a try for certain.
> >It sounds a little chicken-and-the-egg though .... does the top-level
> >maven.xml copy the *.properties into the sub-projects, or do the
> >sub-projects copy from ../*.properties themselves?
> >
> >----- Original Message ----- 
> >From: "Vincent Massol" <vm...@pivolis.com>
> >To: "'Maven Users List'" <us...@maven.apache.org>
> >Sent: Friday, September 19, 2003 11:35 AM
> >Subject: RE: Any way to have shared properties when extending from a base
> >project
> >
> >
> >
> >
> >>Hi Colin,
> >>
> >>This is a known wanted feature (I also want it dearly). Check JIRA. It's
> >>scheduled for 1.1. If you want it faster, please send a patch and I'll
> >>gladly apply it :-)
> >>
> >>As a workaround on my work project, we have a custom maven.xml goal that
> >>copies the top level project.properties to the current project you're
> >>building. That means of course that you have to put all properties at
> >>the top level.
> >>
> >>Thanks
> >>-Vincent
> >>
> >>
> >>
> >>>-----Original Message-----
> >>>From: Colin Sampaleanu [mailto:colinml1@exis.com]
> >>>Sent: 19 September 2003 20:30
> >>>To: Maven Users List
> >>>Subject: Any way to have shared properties when extending from a base
> >>>project
> >>>
> >>>I just realized that while you can extend a project with something
> >>>
> >>>
> >>like
> >>
> >>
> >>>   extend>${basedir}/../master/project.xml</extend>
> >>>maven doesn't seem to read in build.properties (and project.properties
> >>>either I guess) from the master project. This is a real PITA, as I
> >>>
> >>>
> >>don't
> >>
> >>
> >>>want to force people to put identical build.properties files in all
> >>>
> >>>
> >>the
> >>
> >>
> >>>subprojects, and it's not acceptible to have a build.properties file
> >>>
> >>>
> >>in
> >>
> >>
> >>>the user directory, as it will trample the version for other projects.
> >>>
> >>>I think I'm missing something, as this is a big hole. What are other
> >>>people doing in this situation?
> >>>
> >>>Regards,
> >>>Colin
> >>>
> >>>
>
>
>
> ---------------------------------------------------------------------
> 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: Any way to have shared properties when extending from a base project

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Colin Sampaleanu [mailto:colinml1@exis.com]
> Sent: 19 September 2003 20:54
> To: Maven Users List
> Subject: Re: Any way to have shared properties when extending from a
base
> project
> 
> Actaully, I like your method a bit better, 

me too although there is a small drawback... We have 300+ maven projects
and there are at different level in the directory hierarchy ... So to
make this work we need to have a maven.xml for each project (we can't
factor this in the top level maven.xml, or we need some logic to compute
number of path separators compare to a prefix (should be possible
actually...).

> since I want to have a
> top-level build.properties, but still allow a build.properties in the
> project to override that if possible. Since I have a maven.xml in
every
> subproject anyways, it's not that big a deal to read in some files
there.
> 
> Only issue is triggering the read. There used to be a build start goal
> (forgot what the name was) that you could use to attach off of (with a
> postGoal), but it got broken a long long time ago. I forgot the exact
> name. Does anybody know if this goal is still non-existentbroken? I
had
> a look in Jira, but couldn't find an issue. Without that goal, it's
> almost impossible to do something at the begining of every build (like
> readin in properties) when you don't know what goal the user will be
> running, so you can do a preGoal off that or one of its
dependencies...

I've filed an issue for this in JIRA... it was broken last time I
checked. The goal is in driver.jelly

http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-488

-Vincent

> 
> Colin
> 
> khote wrote:
> 
> >this method works?  I'm going to give it a try for certain.
> >It sounds a little chicken-and-the-egg though .... does the top-level
> >maven.xml copy the *.properties into the sub-projects, or do the
> >sub-projects copy from ../*.properties themselves?
> >
> >----- Original Message -----
> >From: "Vincent Massol" <vm...@pivolis.com>
> >To: "'Maven Users List'" <us...@maven.apache.org>
> >Sent: Friday, September 19, 2003 11:35 AM
> >Subject: RE: Any way to have shared properties when extending from a
base
> >project
> >
> >
> >
> >
> >>Hi Colin,
> >>
> >>This is a known wanted feature (I also want it dearly). Check JIRA.
It's
> >>scheduled for 1.1. If you want it faster, please send a patch and
I'll
> >>gladly apply it :-)
> >>
> >>As a workaround on my work project, we have a custom maven.xml goal
that
> >>copies the top level project.properties to the current project
you're
> >>building. That means of course that you have to put all properties
at
> >>the top level.
> >>
> >>Thanks
> >>-Vincent
> >>
> >>
> >>
> >>>-----Original Message-----
> >>>From: Colin Sampaleanu [mailto:colinml1@exis.com]
> >>>Sent: 19 September 2003 20:30
> >>>To: Maven Users List
> >>>Subject: Any way to have shared properties when extending from a
base
> >>>project
> >>>
> >>>I just realized that while you can extend a project with something
> >>>
> >>>
> >>like
> >>
> >>
> >>>   extend>${basedir}/../master/project.xml</extend>
> >>>maven doesn't seem to read in build.properties (and
project.properties
> >>>either I guess) from the master project. This is a real PITA, as I
> >>>
> >>>
> >>don't
> >>
> >>
> >>>want to force people to put identical build.properties files in all
> >>>
> >>>
> >>the
> >>
> >>
> >>>subprojects, and it's not acceptible to have a build.properties
file
> >>>
> >>>
> >>in
> >>
> >>
> >>>the user directory, as it will trample the version for other
projects.
> >>>
> >>>I think I'm missing something, as this is a big hole. What are
other
> >>>people doing in this situation?
> >>>
> >>>Regards,
> >>>Colin
> >>>
> >>>
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Any way to have shared properties when extending from a base project

Posted by Colin Sampaleanu <co...@exis.com>.
Actaully, I like your method a bit better, since I want to have a 
top-level build.properties, but still allow a build.properties in the 
project to override that if possible. Since I have a maven.xml in every 
subproject anyways, it's not that big a deal to read in some files there.

Only issue is triggering the read. There used to be a build start goal 
(forgot what the name was) that you could use to attach off of (with a 
postGoal), but it got broken a long long time ago. I forgot the exact 
name. Does anybody know if this goal is still non-existentbroken? I had 
a look in Jira, but couldn't find an issue. Without that goal, it's 
almost impossible to do something at the begining of every build (like 
readin in properties) when you don't know what goal the user will be 
running, so you can do a preGoal off that or one of its dependencies...

Colin

khote wrote:

>this method works?  I'm going to give it a try for certain.
>It sounds a little chicken-and-the-egg though .... does the top-level
>maven.xml copy the *.properties into the sub-projects, or do the
>sub-projects copy from ../*.properties themselves?
>
>----- Original Message ----- 
>From: "Vincent Massol" <vm...@pivolis.com>
>To: "'Maven Users List'" <us...@maven.apache.org>
>Sent: Friday, September 19, 2003 11:35 AM
>Subject: RE: Any way to have shared properties when extending from a base
>project
>
>
>  
>
>>Hi Colin,
>>
>>This is a known wanted feature (I also want it dearly). Check JIRA. It's
>>scheduled for 1.1. If you want it faster, please send a patch and I'll
>>gladly apply it :-)
>>
>>As a workaround on my work project, we have a custom maven.xml goal that
>>copies the top level project.properties to the current project you're
>>building. That means of course that you have to put all properties at
>>the top level.
>>
>>Thanks
>>-Vincent
>>
>>    
>>
>>>-----Original Message-----
>>>From: Colin Sampaleanu [mailto:colinml1@exis.com]
>>>Sent: 19 September 2003 20:30
>>>To: Maven Users List
>>>Subject: Any way to have shared properties when extending from a base
>>>project
>>>
>>>I just realized that while you can extend a project with something
>>>      
>>>
>>like
>>    
>>
>>>   extend>${basedir}/../master/project.xml</extend>
>>>maven doesn't seem to read in build.properties (and project.properties
>>>either I guess) from the master project. This is a real PITA, as I
>>>      
>>>
>>don't
>>    
>>
>>>want to force people to put identical build.properties files in all
>>>      
>>>
>>the
>>    
>>
>>>subprojects, and it's not acceptible to have a build.properties file
>>>      
>>>
>>in
>>    
>>
>>>the user directory, as it will trample the version for other projects.
>>>
>>>I think I'm missing something, as this is a big hole. What are other
>>>people doing in this situation?
>>>
>>>Regards,
>>>Colin
>>>      
>>>



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


Re: Any way to have shared properties when extending from a base project

Posted by khote <kh...@mminternet.com>.
this method works?  I'm going to give it a try for certain.
It sounds a little chicken-and-the-egg though .... does the top-level
maven.xml copy the *.properties into the sub-projects, or do the
sub-projects copy from ../*.properties themselves?

----- Original Message ----- 
From: "Vincent Massol" <vm...@pivolis.com>
To: "'Maven Users List'" <us...@maven.apache.org>
Sent: Friday, September 19, 2003 11:35 AM
Subject: RE: Any way to have shared properties when extending from a base
project


> Hi Colin,
>
> This is a known wanted feature (I also want it dearly). Check JIRA. It's
> scheduled for 1.1. If you want it faster, please send a patch and I'll
> gladly apply it :-)
>
> As a workaround on my work project, we have a custom maven.xml goal that
> copies the top level project.properties to the current project you're
> building. That means of course that you have to put all properties at
> the top level.
>
> Thanks
> -Vincent
>
> > -----Original Message-----
> > From: Colin Sampaleanu [mailto:colinml1@exis.com]
> > Sent: 19 September 2003 20:30
> > To: Maven Users List
> > Subject: Any way to have shared properties when extending from a base
> > project
> >
> > I just realized that while you can extend a project with something
> like
> >    extend>${basedir}/../master/project.xml</extend>
> > maven doesn't seem to read in build.properties (and project.properties
> > either I guess) from the master project. This is a real PITA, as I
> don't
> > want to force people to put identical build.properties files in all
> the
> > subprojects, and it's not acceptible to have a build.properties file
> in
> > the user directory, as it will trample the version for other projects.
> >
> > I think I'm missing something, as this is a big hole. What are other
> > people doing in this situation?
> >
> > Regards,
> > Colin
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: Any way to have shared properties when extending from a base project

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Colin,

This is a known wanted feature (I also want it dearly). Check JIRA. It's
scheduled for 1.1. If you want it faster, please send a patch and I'll
gladly apply it :-)

As a workaround on my work project, we have a custom maven.xml goal that
copies the top level project.properties to the current project you're
building. That means of course that you have to put all properties at
the top level.

Thanks
-Vincent

> -----Original Message-----
> From: Colin Sampaleanu [mailto:colinml1@exis.com]
> Sent: 19 September 2003 20:30
> To: Maven Users List
> Subject: Any way to have shared properties when extending from a base
> project
> 
> I just realized that while you can extend a project with something
like
>    extend>${basedir}/../master/project.xml</extend>
> maven doesn't seem to read in build.properties (and project.properties
> either I guess) from the master project. This is a real PITA, as I
don't
> want to force people to put identical build.properties files in all
the
> subprojects, and it's not acceptible to have a build.properties file
in
> the user directory, as it will trample the version for other projects.
> 
> I think I'm missing something, as this is a big hole. What are other
> people doing in this situation?
> 
> Regards,
> Colin
> 
> 
> 
> ---------------------------------------------------------------------
> 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