You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by khote <kh...@mminternet.com> on 2003/09/28 01:44:04 UTC

environment variables in properties files

Is it possible to use environment variables in a project.properties?

example:  I have team members working in their own cvs "sandbox"
I would like for them to have something in their .bash_profile such as:
  export SANDBOX=/home/fred/sandboxes/chronicle

and then use that SANDBOX variable as a value in a certain
project.properties, such as:

maven.sandbox = ${SANDBOX}

I know from ant that you can   <property environment="env"/>
and use env.SANDBOX.  Does maven do anything like this automatically?


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


[Continued]: environment variables in properties files

Posted by khote <kh...@mminternet.com>.
I found that by doing the
  <property environment="env"/>

I could in fact use

  maven.sandbox = ${env.SANDBOX}

in my build and project.properties, particularly useful in child projects
that want to inherit from a master project, but be executed from within
their own directory.  Setting up the dependencies in just the right order
from a Master with Child projects, each having their own sub-projects (and
thus dependencies) .... sometimes complexity and chaos are the same thing.

This leads me to wonder how the properties in build/project.properties are
set?  What's the parse sequencing?  I mean, how it it that I can execute
that property environment thing within maven.xml and still have it effect
values in build/project.properties?
I'm doing it outside of any goal, just at the top of the maven.xml file, ie
within <project> but not within <goal>.  I also discovered that if I attempt
in this situation to <attainGoal> of some goal later described in the same
maven.xml it won't work, but if I put the <goal name="..."> business before
this "ungoaled" section, it would.

I also (think) I found that while ant is first-set, when doing:

<loadproperty file="${basedir}/../build.properties" />
<loadproperty file="${basedir}/../project.properties" />

Jelly's util:properties works last-set:

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

duh, that would have been nice to know from somewhere :-P

----- Original Message ----- 
From: "khote" <kh...@mminternet.com>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Saturday, September 27, 2003 4:44 PM
Subject: environment variables in properties files


> Is it possible to use environment variables in a project.properties?
>
> example:  I have team members working in their own cvs "sandbox"
> I would like for them to have something in their .bash_profile such as:
>   export SANDBOX=/home/fred/sandboxes/chronicle
>
> and then use that SANDBOX variable as a value in a certain
> project.properties, such as:
>
> maven.sandbox = ${SANDBOX}
>
> I know from ant that you can   <property environment="env"/>
> and use env.SANDBOX.  Does maven do anything like this automatically?
>
>
> ---------------------------------------------------------------------
> 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