You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Łukasz Tasz <lu...@tasz.eu> on 2012/06/19 14:03:33 UTC
default value for property
Hi All,
I'm not mvn expert, but I'm working a lot others build systems.
I'm missing one of fundamental functionality, default value for
variable / property in case of maven.
I would like to start mvn process and optionally parametrize it by
environment variable.
e.g
<properties>
<myProp>${env.turboMode}:slowmode</myProp>
</properties>
so if environmente variable is seted then myProp will get it;s value,
if not then slowmode will be the value.
I' sure that I'm missing some manual page, but please don't blame :)
Thanks a lot
--
Łukasz Tasz
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: default value for property
Posted by Curtis Rueden <ct...@wisc.edu>.
Hi Łukasz,
> So you want to say that I'm always forced to add -P switch to maven
> call to change values?
Nope, I think what Anders meant is something like:
<properties>
<myProp>slowmode</myProp>
</properties>
......
<profiles>
<profile>
<id>turboMode</id>
<activation>
<property>
<name>env.turboMode</name>
</property>
</activation>
<properties>
<myProp>${env.turboMode}</myProp>
</properties>
</profile>
</profiles>
For details, see:
http://maven.apache.org/pom.html#Activation
> One more question, system property always overwrites property?
Sorry, not sure what you're asking here.
HTH,
Curtis
On Tue, Jun 19, 2012 at 7:59 AM, Łukasz Tasz <lu...@tasz.eu> wrote:
> Hi thanks for answer,
>
> 2012/6/19 Anders Hammar <an...@hammar.net>:
> > You can accomplish something like this through some profiles magic.
> > But I'd like to stress that the Maven theme is to have predictable
> > (and reproducible) builds. To ensure that, the build output can't
> > depend on the environment.
>
> I thought that reproducible build means if input is the same then
> output must be the same :)
> and environment variables are always part of build - at least maven
> gives interface to env.
>
> >
> > But if you absolutely have to do this through profiles, this is what you
> do:
> > * Define the property with the default value.
> > * Create a profile that is triggered on the env variable, and that
> > profile with re-define the property to the value of the env variable
> > (or whatever you want).
> So you want to say that I'm always forced to add -P switch to maven
> call to change values?
> Maybe I will explain reasons,
> I'm signing jars with jarsigner plugin.
> There is requirement that developer build is executed within same
> profiles sets.
> Since not each developer cares about signing rpms, I would like to
> provide default dummy key - through default properties,
> but in case of qa build, env vars will point real keystore.
>
> One more question, system property always overwrites property?
>
> br
> L.
> >
> > /Anders
> >
> > On Tue, Jun 19, 2012 at 2:03 PM, Łukasz Tasz <lu...@tasz.eu> wrote:
> >> Hi All,
> >>
> >> I'm not mvn expert, but I'm working a lot others build systems.
> >> I'm missing one of fundamental functionality, default value for
> >> variable / property in case of maven.
> >>
> >> I would like to start mvn process and optionally parametrize it by
> >> environment variable.
> >>
> >> e.g
> >> <properties>
> >> <myProp>${env.turboMode}:slowmode</myProp>
> >> </properties>
> >>
> >> so if environmente variable is seted then myProp will get it;s value,
> >> if not then slowmode will be the value.
> >>
> >> I' sure that I'm missing some manual page, but please don't blame :)
> >>
> >> Thanks a lot
> >>
> >> --
> >> Łukasz Tasz
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
>
>
>
> --
> --
> Łukasz Tasz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: default value for property
Posted by Anders Hammar <an...@hammar.net>.
> One more question, system property always overwrites property?
No, never. System properties and POM properties are kept separate by
Maven. HOWEVER, system properties are (should) be the preferred value
when interpolating. But there has been some bugs in this area. Latest
Maven 3 and latest plugins should work well though.
/Anders
>
> br
> L.
>>
>> /Anders
>>
>> On Tue, Jun 19, 2012 at 2:03 PM, Łukasz Tasz <lu...@tasz.eu> wrote:
>>> Hi All,
>>>
>>> I'm not mvn expert, but I'm working a lot others build systems.
>>> I'm missing one of fundamental functionality, default value for
>>> variable / property in case of maven.
>>>
>>> I would like to start mvn process and optionally parametrize it by
>>> environment variable.
>>>
>>> e.g
>>> <properties>
>>> <myProp>${env.turboMode}:slowmode</myProp>
>>> </properties>
>>>
>>> so if environmente variable is seted then myProp will get it;s value,
>>> if not then slowmode will be the value.
>>>
>>> I' sure that I'm missing some manual page, but please don't blame :)
>>>
>>> Thanks a lot
>>>
>>> --
>>> Łukasz Tasz
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
>
> --
> --
> Łukasz Tasz
>
> ---------------------------------------------------------------------
> 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: default value for property
Posted by Łukasz Tasz <lu...@tasz.eu>.
Hi thanks for answer,
2012/6/19 Anders Hammar <an...@hammar.net>:
> You can accomplish something like this through some profiles magic.
> But I'd like to stress that the Maven theme is to have predictable
> (and reproducible) builds. To ensure that, the build output can't
> depend on the environment.
I thought that reproducible build means if input is the same then
output must be the same :)
and environment variables are always part of build - at least maven
gives interface to env.
>
> But if you absolutely have to do this through profiles, this is what you do:
> * Define the property with the default value.
> * Create a profile that is triggered on the env variable, and that
> profile with re-define the property to the value of the env variable
> (or whatever you want).
So you want to say that I'm always forced to add -P switch to maven
call to change values?
Maybe I will explain reasons,
I'm signing jars with jarsigner plugin.
There is requirement that developer build is executed within same
profiles sets.
Since not each developer cares about signing rpms, I would like to
provide default dummy key - through default properties,
but in case of qa build, env vars will point real keystore.
One more question, system property always overwrites property?
br
L.
>
> /Anders
>
> On Tue, Jun 19, 2012 at 2:03 PM, Łukasz Tasz <lu...@tasz.eu> wrote:
>> Hi All,
>>
>> I'm not mvn expert, but I'm working a lot others build systems.
>> I'm missing one of fundamental functionality, default value for
>> variable / property in case of maven.
>>
>> I would like to start mvn process and optionally parametrize it by
>> environment variable.
>>
>> e.g
>> <properties>
>> <myProp>${env.turboMode}:slowmode</myProp>
>> </properties>
>>
>> so if environmente variable is seted then myProp will get it;s value,
>> if not then slowmode will be the value.
>>
>> I' sure that I'm missing some manual page, but please don't blame :)
>>
>> Thanks a lot
>>
>> --
>> Łukasz Tasz
>>
>> ---------------------------------------------------------------------
>> 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
>
--
--
Łukasz Tasz
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: default value for property
Posted by Anders Hammar <an...@hammar.net>.
You can accomplish something like this through some profiles magic.
But I'd like to stress that the Maven theme is to have predictable
(and reproducible) builds. To ensure that, the build output can't
depend on the environment.
But if you absolutely have to do this through profiles, this is what you do:
* Define the property with the default value.
* Create a profile that is triggered on the env variable, and that
profile with re-define the property to the value of the env variable
(or whatever you want).
/Anders
On Tue, Jun 19, 2012 at 2:03 PM, Łukasz Tasz <lu...@tasz.eu> wrote:
> Hi All,
>
> I'm not mvn expert, but I'm working a lot others build systems.
> I'm missing one of fundamental functionality, default value for
> variable / property in case of maven.
>
> I would like to start mvn process and optionally parametrize it by
> environment variable.
>
> e.g
> <properties>
> <myProp>${env.turboMode}:slowmode</myProp>
> </properties>
>
> so if environmente variable is seted then myProp will get it;s value,
> if not then slowmode will be the value.
>
> I' sure that I'm missing some manual page, but please don't blame :)
>
> Thanks a lot
>
> --
> Łukasz Tasz
>
> ---------------------------------------------------------------------
> 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