You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gareth Tilley <ga...@rmb.co.za> on 2006/11/08 11:14:51 UTC

Re: Properties/Variables in pom?

Hi All,


Gunther Popp-2 wrote:
> 
> - All (platform-specific) Environment variables (Just add the prefix 
> env. For example ${env.M2_HOME} returns the Maven2 installation path).
> 

Has anyone actually been able to get this working? All of the filtering
works fine for me, but the environment variable stuff does not.  As a test I
have a properties file that contains:
${env.JAVA_HOME}
${user.home}
${pom.version}

After the process-resources phase (with filtering turn on in the pom), the
file looks like this:
${env.JAVA_HOME}
/home/build
1.2-SNAPSHOT

JAVA_HOME is definitely set, is there something I am doing wrong, or does
this just not work?

Regards
Gareth




Hi Andreas!

Take a look at the Getting Started Guide 
(http://maven.apache.org/guides/getting-started/index.html), section 
"How do I filter resource files?". It explains how to reference the 
elements of the pom.xml/settings.xml using property-names.

I´m currently working on a book that covers Maven 2 as part of a 
pragmatic configuration management process and have done some "research" 
concerning the usage of properties. AFAIK, properties are resolved in 
the following order:

- The (hard-coded) property ${basedir} (contains the path of the POM-file)
- All Java System Properties defined by the JVM.
- All properties defined in the properties-element of the POM.
- All elements in pom.xml and settings.xml as stated above
- All (platform-specific) Environment variables (Just add the prefix 
env. For example ${env.M2_HOME} returns the Maven2 installation path).

I´m not 100% sure about the list and appreciate any additions/corrections.

CU,

Gunther

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




-- 
View this message in context: http://www.nabble.com/Variables-in-pom--tf1290889s177.html#a7235831
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Properties/Variables in pom?

Posted by Gunther Popp <ma...@guntherpopp.de>.
Hi!

AFAIK, this only works _within_ the POM itself (i.e. in the 
configuration section of plugins). I don´t know if it works for the 
file-filtering stuff.

CU,

Gunther

Gareth Tilley schrieb:
> Hi All,
>
>
> Gunther Popp-2 wrote:
>   
>> - All (platform-specific) Environment variables (Just add the prefix 
>> env. For example ${env.M2_HOME} returns the Maven2 installation path).
>>
>>     
>
> Has anyone actually been able to get this working? All of the filtering
> works fine for me, but the environment variable stuff does not.  As a test I
> have a properties file that contains:
> ${env.JAVA_HOME}
> ${user.home}
> ${pom.version}
>
> After the process-resources phase (with filtering turn on in the pom), the
> file looks like this:
> ${env.JAVA_HOME}
> /home/build
> 1.2-SNAPSHOT
>
> JAVA_HOME is definitely set, is there something I am doing wrong, or does
> this just not work?
>
> Regards
> Gareth
>
>
>
>
> Hi Andreas!
>
> Take a look at the Getting Started Guide 
> (http://maven.apache.org/guides/getting-started/index.html), section 
> "How do I filter resource files?". It explains how to reference the 
> elements of the pom.xml/settings.xml using property-names.
>
> I´m currently working on a book that covers Maven 2 as part of a 
> pragmatic configuration management process and have done some "research" 
> concerning the usage of properties. AFAIK, properties are resolved in 
> the following order:
>
> - The (hard-coded) property ${basedir} (contains the path of the POM-file)
> - All Java System Properties defined by the JVM.
> - All properties defined in the properties-element of the POM.
> - All elements in pom.xml and settings.xml as stated above
> - All (platform-specific) Environment variables (Just add the prefix 
> env. For example ${env.M2_HOME} returns the Maven2 installation path).
>
> I´m not 100% sure about the list and appreciate any additions/corrections.
>
> CU,
>
> Gunther
>
> ---------------------------------------------------------------------
> 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