I put this in each subproject's maven.xml:

  <ant:property file="${basedir}/../project.properties"/>
  <util:available file="${basedir}/../build.properties">
    <util:properties file="${basedir}/../build.properties" trim="true" />
  </util:available>

I'm trying to force this order of precedence (from the subproject's
viewpoint) when defining properties:

  1. ../build.properties
  2. project.properties
  3. ../project.properties

>From what I can tell the subproject project.properties gets loaded
before the subproject maven.xml. I load the master project.properties
using Ant so as not to override anything defined in the subproject's
project.properties. I then load the master build.properties using
Jelly, because I want properties defined there to override properties
defined elsewhere. You could also load user-specific properties last
using Jelly to give them the highest priority.

When Maven supports property inheritence, I don't know if it will do
so in this order, but it made sense for me.

  Jeff

On Fri, 6 Feb 2004, at 12:06:34 [GMT +0100] Julien Stern wrote:

> All,

> I was wondering whether (and how) it was possible to share properties
> between various projects.

> I have about 50 subprojects and I would like to be able to setup common
> properties for them it a single place. I would also like to be able to
> put these properties in CVS and not in my user home dir.

> However, it seems to be impossible to specify or import a property file
> from another one (or is it?).

> And if I use the reactor or the multiproject plugin, some properties
> seem to be unsettable at the top level because of path problems.
> More specifically, for exemple, I did not manage to set a common
> maven.checkstyle.properties for all my subprojects

> I tried to put in the top-level project.properties :
> 1) maven.checkstyle.properties=mycheckstyle.xml 
> 2) maven.checkstyle.properties=${basedir}/mycheckstyle.xml 

> but it failed both with a handmade reactor and the multiproject plugin.
> And I cannot put an absolute path because that would require checking out
> the CVS in a specific place, or modifying the path after the checkout.


> Also, is there any way to share a property file for subprojects on
> which maven could be invoked independently?
> I did manage to share _some_ properties by putting them in a top-level
> property file and invoking a reactor, but then, I cannot invoke maven
> directly from a subproject with these properties.

> (Using beta-9, 1.0-rc1 and cvs HEAD by the way.)

> Thanks,

> --
> Julien

-- 
mailto:[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to