You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "David C. Hicks" <dh...@i-hicks.org> on 2008/10/14 20:42:10 UTC

Default env.property values.

Is there a way to have Maven use a default value if the environment 
variable referenced by an env.VAR property is not set?

Example:

<my.build.number>${env.BUILD_NUMBER}</my.build.number

This is how you might capture the build number from a Hudson CI server.  
For a developer, though, the value would end up blank.  I'd rather it 
say "DEVELOPMENT".  Can that be done?

Thanks,
Dave


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


Re: RESOLVED: Default env.property values.

Posted by "David C. Hicks" <dh...@i-hicks.org>.
Yes, I suppose that would be one way of activating it. In my case, I 
know that the environment variable is set by Hudson, so I just added 
"-Pspecial" to my build command.

Good tip for general purposes, though!


Stevo Slavic' wrote:
> Shouldn't your profile with id=special also contain:
>
> <profiles>
>   <profile>
>     <id>special</id>
>     <activation>
>       <property>
>         <name>env.BUILD_NUMBER</name>
>       </property>
>     </activation>
>     ...
>   </profile>
> </profiles>
>
> to have profile active only when environment variable BUILD_NUMBER is
> present?
>
> Regards,
> Stevo.
>
> On Tue, Oct 14, 2008 at 9:55 PM, David C. Hicks <dh...@i-hicks.org> wrote:
>
>   
>> I solved this using a profile for my "special" build environment.  Pretty
>> straightforward.  For those who are interested, here is my solution...
>>
>> Example:
>> <properties>
>>   <my.property>defaultValue<my.property>
>> </properties>
>>
>> <profiles>
>>   <profile>
>>      <id>special</id>
>>      <properties>
>>         <my.property>${env.BUILD_NUMBER}</my.property>
>>      </properties>
>>   </profile>
>> </profiles>
>>
>>
>> David C. Hicks wrote:
>>
>>     
>>> Is there a way to have Maven use a default value if the environment
>>> variable referenced by an env.VAR property is not set?
>>>
>>> Example:
>>>
>>> <my.build.number>${env.BUILD_NUMBER}</my.build.number
>>>
>>> This is how you might capture the build number from a Hudson CI server.
>>>  For a developer, though, the value would end up blank.  I'd rather it say
>>> "DEVELOPMENT".  Can that be done?
>>>
>>> Thanks,
>>> Dave
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>     
>
>   

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


Re: RESOLVED: Default env.property values.

Posted by Stevo Slavić <ss...@gmail.com>.
Shouldn't your profile with id=special also contain:

<profiles>
  <profile>
    <id>special</id>
    <activation>
      <property>
        <name>env.BUILD_NUMBER</name>
      </property>
    </activation>
    ...
  </profile>
</profiles>

to have profile active only when environment variable BUILD_NUMBER is
present?

Regards,
Stevo.

On Tue, Oct 14, 2008 at 9:55 PM, David C. Hicks <dh...@i-hicks.org> wrote:

> I solved this using a profile for my "special" build environment.  Pretty
> straightforward.  For those who are interested, here is my solution...
>
> Example:
> <properties>
>   <my.property>defaultValue<my.property>
> </properties>
>
> <profiles>
>   <profile>
>      <id>special</id>
>      <properties>
>         <my.property>${env.BUILD_NUMBER}</my.property>
>      </properties>
>   </profile>
> </profiles>
>
>
> David C. Hicks wrote:
>
>> Is there a way to have Maven use a default value if the environment
>> variable referenced by an env.VAR property is not set?
>>
>> Example:
>>
>> <my.build.number>${env.BUILD_NUMBER}</my.build.number
>>
>> This is how you might capture the build number from a Hudson CI server.
>>  For a developer, though, the value would end up blank.  I'd rather it say
>> "DEVELOPMENT".  Can that be done?
>>
>> Thanks,
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>

RESOLVED: Default env.property values.

Posted by "David C. Hicks" <dh...@i-hicks.org>.
I solved this using a profile for my "special" build environment.  
Pretty straightforward.  For those who are interested, here is my 
solution...

Example:
<properties>
    <my.property>defaultValue<my.property>
</properties>

<profiles>
    <profile>
       <id>special</id>
       <properties>
          <my.property>${env.BUILD_NUMBER}</my.property>
       </properties>
    </profile>
</profiles>


David C. Hicks wrote:
> Is there a way to have Maven use a default value if the environment 
> variable referenced by an env.VAR property is not set?
>
> Example:
>
> <my.build.number>${env.BUILD_NUMBER}</my.build.number
>
> This is how you might capture the build number from a Hudson CI 
> server.  For a developer, though, the value would end up blank.  I'd 
> rather it say "DEVELOPMENT".  Can that be done?
>
> Thanks,
> Dave
>
>
> ---------------------------------------------------------------------
> 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