Good day,

If im not mistaken, Java (the programming language behind maven) does
differentiate the System and Environment Variables. Both are retrieved via
System.getProperties(). So as to which takes precedence over the other,
probably  depends on the JVM.

Anyway, if im not mistaken, the proper priority for maven-resources-plugin
(and maven-war-plugin) is as follows:

S/E < POM < CL < Filter

Meaning, Filter properties overrides all. Commandline properties (-D
<key>=<value>) overrides all but Filter Properties. POM properties overrides
only the System/Environment Properties. And System/Environment Properties
overrides nothing.

Note: though you will see something like:

reader = new InterpolationFilterReader( reader, new ReflectionProperties(
project, isPropertiesFile ), "${", "}" );

in ResourcesMojo, I don't think it actually works.

Cheers,
Franz


Minto.van.der.Sluis wrote:
> 
> 
> 
> Hi folks,
> 
> Not being sure how these properties are exactly used, I think you have
> to take good care of where you put that line. The order of importance
> need good consideration. Your situation results in:
> 
>       - system properties
>       - project properties
>       - environment properties
> 
> In this situation project properties take precedent over environment
> properties. Is this the right behaviour? Like this you can put anything
> in your environment, but as long as it is in the project as well, the
> environment properties will not get used. IMO this is incorrect. I think
> the following order is better:
> 
>       - system properties
>       - environment properties
>       - project properties
> 
> In this situation system properties (commandline) are most important. If
> properties can not be found in system properties, the environment
> properties will be checked. Project properties will only get used as a
> last resort. 
> 
> I can be wrong in my analysis, but I would like to stress that it
> probably is important where to put that line :)
> 
> Kind regard,
> 
> Minto van der Sluis
> 
> 
> 
> 
> -----Oorspronkelijk bericht-----
> Van: Haroon Rafique [mailto:[EMAIL PROTECTED] 
> Verzonden: donderdag 9 november 2006 18:03
> Aan: Maven Users List
> Onderwerp: Re: Resource filtering using environment variables
> 
> On Today at 11:20am, HR=>Haroon Rafique <[EMAIL PROTECTED]>
> wrote:
> 
> HR> [..snip..]
> HR> 
> 
> Something like the following should work (not tested):
> 
> import org.codehaus.plexus.util.cli.CommandLineUtils;
> 
> 
> HR>         filterProperties = new Properties();
> HR>         
> HR>         // System properties
> HR>         filterProperties.putAll( System.getProperties() );
> HR>         
> HR>         // Project properties
> HR>         filterProperties.putAll( project.getProperties() );
> HR> 
> 
> follow the above two calls with:
> 
>       // Environment variables
>       filterProperties.putAll( CommandLineUtils.getSystemEnvVars() );
> 
> Anyone willing to give it a try?
> 
> Later,
> --
> Haroon Rafique
> <[EMAIL PROTECTED]>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> DISCLAIMER
> De informatie in deze e-mail is vertrouwelijk en uitsluitend bestemd voor
> de geadresseerde. Indien u niet de geadresseerde bent, wordt u er hierbij
> op gewezen, dat u geen recht heeft kennis te nemen van de rest van deze
> e-mail, deze te gebruiken, te kopieren of te verstrekken aan andere
> personen dan de geadresseerde. Indien u deze e-mail abusievelijk hebt
> ontvangen, brengt u dan alstublieft de afzender op de hoogte, waarbij u
> bij deze gevraagd wordt het originele bericht te vernietigen. Politie
> Amsterdam-Amstelland is niet verantwoordelijk voor de inhoud van deze
> e-mail en wijst iedere aansprakelijkheid af voor en/of in verband met alle
> gevolgen en/of schade van een onjuiste of onvolledige verzending ervan.
> Tenzij uitdrukkelijk het tegendeel blijkt, kunnen aan dit bericht geen
> rechten worden ontleend. Het gebruik van Internet e-mail brengt zekere
> risicos met zich. Daarom wordt iedere aansprakelijkheid voor het gebruik
> van dit medium door de Politie Amsterdam-Amstelland van de hand gewezen. 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Resource-filtering-using-environment-variables-tf2600791s177.html#a7275929
Sent from the Maven - Users mailing list archive at Nabble.com.


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

Reply via email to