You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Patrizio Munzi <pa...@eris4.com> on 2008/01/16 15:00:11 UTC

maven properties seem not to work in profile activation feature

Hi all,

I'm trying to manage profiles activations/deactivations by using the 
activation tag among with the file tag.
What I would like to do is to activate a particular profile only if a 
specified folder is present into the local repository.
The profile configuration I'm using is the following:

  <profiles>
    <profile>
      <id>apache</id>
      <activation>
        <activeByDefault>false</activeByDefault>
        <file>
          
<missing>${settings.localRepository}/org/apache/maven/plugins/maven-jar-plugin/2.2-SNAPSHOT</missing>
        </file>
      </activation>
      <repositories>
        [...]
      </repositories>
      <pluginRepositories>
        [...]
      </pluginRepositories>
    </profile>
  </profiles>

Now, if I use the explicit path of the local repository everything works 
well, instead if I use the property ${settings.localRepository} id 
doesn't work. It seems that maven isn't able to give a value to the 
property. I tried this profile configuration in both settings.xml and 
pom.xml files.
Moreover I even tried to use different properties (e.g. ${user.dir}. 
${usr.home}) but in all the case I had no successful results.

Have I missed something...?

Is there any problem in managing properties..?

Thanks


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


Re: maven properties seem not to work in profile activation feature

Posted by Patrizio Munzi <pa...@eris4.com>.
Hi,

so file based profile activation can't be used without breaking down 
project portability.
Is there any workaround...?

By the way there is already an issue about that on Jira...

Thanks a lot.

BR
Patrizio

nicolas de loof wrote:
> You're right, properties interpolation IS NOT used to compute file path
> during profile activation.
> The main cause is that profiles may define / override properties values.
>
> I agree that some properties like ${basedir} and ${settings.x} MAY be
> supported, as this restriction makes the file based activation useless.
>
> Not sure but there may allready be a Jira issue about this. Please search or
> create one for this, as this SHOULD be fixed in future maven 2.x
>
> Nico.
>
> 2008/1/16, Patrizio Munzi <pa...@eris4.com>:
>   
>> Hi all,
>>
>> I'm trying to manage profiles activations/deactivations by using the
>> activation tag among with the file tag.
>> What I would like to do is to activate a particular profile only if a
>> specified folder is present into the local repository.
>> The profile configuration I'm using is the following:
>>
>>   <profiles>
>>     <profile>
>>       <id>apache</id>
>>       <activation>
>>         <activeByDefault>false</activeByDefault>
>>         <file>
>>
>> <missing>${settings.localRepository
>> }/org/apache/maven/plugins/maven-jar-plugin/2.2-SNAPSHOT</missing>
>>         </file>
>>       </activation>
>>       <repositories>
>>         [...]
>>       </repositories>
>>       <pluginRepositories>
>>         [...]
>>       </pluginRepositories>
>>     </profile>
>>   </profiles>
>>
>> Now, if I use the explicit path of the local repository everything works
>> well, instead if I use the property ${settings.localRepository} id
>> doesn't work. It seems that maven isn't able to give a value to the
>> property. I tried this profile configuration in both settings.xml and
>> pom.xml files.
>> Moreover I even tried to use different properties (e.g. ${user.dir}.
>> ${usr.home}) but in all the case I had no successful results.
>>
>> Have I missed something...?
>>
>> Is there any problem in managing properties..?
>>
>> Thanks
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
>   

-- 

*Patrizio Munzi*
Product Engineer
Viale Bruno Buozzi, 19 - 00197 Roma (Italy)
tel: +39 06 4543 3540
fax: +39 06 4543 3587
mobile: +39 393 7195 164
mail: patrizio.munzi@eris4.com <ma...@eris4.com>
web: http://www.eris4.com <http://www.eris4.com/>
skype: eris4_munzi <skype:eris4_munzi?add>


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


Re: maven properties seem not to work in profile activation feature

Posted by nicolas de loof <ni...@apache.org>.
You're right, properties interpolation IS NOT used to compute file path
during profile activation.
The main cause is that profiles may define / override properties values.

I agree that some properties like ${basedir} and ${settings.x} MAY be
supported, as this restriction makes the file based activation useless.

Not sure but there may allready be a Jira issue about this. Please search or
create one for this, as this SHOULD be fixed in future maven 2.x

Nico.

2008/1/16, Patrizio Munzi <pa...@eris4.com>:
>
> Hi all,
>
> I'm trying to manage profiles activations/deactivations by using the
> activation tag among with the file tag.
> What I would like to do is to activate a particular profile only if a
> specified folder is present into the local repository.
> The profile configuration I'm using is the following:
>
>   <profiles>
>     <profile>
>       <id>apache</id>
>       <activation>
>         <activeByDefault>false</activeByDefault>
>         <file>
>
> <missing>${settings.localRepository
> }/org/apache/maven/plugins/maven-jar-plugin/2.2-SNAPSHOT</missing>
>         </file>
>       </activation>
>       <repositories>
>         [...]
>       </repositories>
>       <pluginRepositories>
>         [...]
>       </pluginRepositories>
>     </profile>
>   </profiles>
>
> Now, if I use the explicit path of the local repository everything works
> well, instead if I use the property ${settings.localRepository} id
> doesn't work. It seems that maven isn't able to give a value to the
> property. I tried this profile configuration in both settings.xml and
> pom.xml files.
> Moreover I even tried to use different properties (e.g. ${user.dir}.
> ${usr.home}) but in all the case I had no successful results.
>
> Have I missed something...?
>
> Is there any problem in managing properties..?
>
> Thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: maven properties seem not to work in profile activation feature

Posted by nicolas de loof <ni...@apache.org>.
Property activation only work for system (command line) properties

Properties from POM are read after profiles have been enabled (as a profile
may define/override properties)

Nico.

2008/2/28, Arnd Kleinbeck <ar...@innoq.com>:
>
> Hi Richard,
>
> does this really work for you? I cannot manage to use a maven property
> value for profile activation, neither if i declare the property in the
> pom nor
> in settings.xml.
>
> As far as i understand, maven property usage for activating profiles
> is not
> supported.
>
> The only solution - as far as i know - would be the implementation of a
> custom profile activator.
> Does this work for maven 2.0.8? Has anybody experiences with that?
>
> BR Arnd
>
> |||  Arnd Kleinbeck
> |||
> |||  innoQ Deutschland GmbH, Halskestr. 17, D-40880 Ratingen, Germany
> |||  phone: +49 2102 77162-100, mobile: +49 163 8780130, fax: +49 2102
> 77160-1
> |||  e-mail: arnd.kleinbeck@innoq.com, web: http://www.innoq.com
>
>
>
> Am 16.01.2008 um 18:54 schrieb Brewster, Richard:
>
> > I ran into this before.  The <localRepository> element is *NOT* a
> > property. Although it can be referenced like one, it does not behave
> > as
> > expected.
> >
> > <localRepository>/m2/repository</localRepository>
> >
> > I defined my own local.repository property that duplicates the path,
> > so
> > I could reference it.
> >
> > In the properties element in settings.xml:
> >
> > <properties>
> >    <local.repository>/m2/repository</local.repository>
> > .. other properties
> > </properties>
> >
> > Now you can write ${local.repository} in your pom.xml and use that in
> > profile activation conditions.
> >
> > Richard Brewster
> > Senior Associate
> > Perrin Quarles Associates
> > richardbrewster@pqa.com
> > (434) 817-2640
> >
> >
> > -----Original Message-----
> > From: Patrizio Munzi [mailto:patrizio.munzi@eris4.com]
> > Sent: Wednesday, January 16, 2008 9:00 AM
> > To: users@maven.apache.org
> > Subject: maven properties seem not to work in profile activation
> > feature
> >
> > Hi all,
> >
> > I'm trying to manage profiles activations/deactivations by using the
> > activation tag among with the file tag.
> > What I would like to do is to activate a particular profile only if a
> > specified folder is present into the local repository.
> > The profile configuration I'm using is the following:
> >
> >  <profiles>
> >    <profile>
> >      <id>apache</id>
> >      <activation>
> >        <activeByDefault>false</activeByDefault>
> >        <file>
> >
> > <missing>${settings.localRepository}/org/apache/maven/plugins/maven-
> > jar-
> > plugin/2.2-SNAPSHOT</missing>
> >        </file>
> >      </activation>
> >      <repositories>
> >        [...]
> >      </repositories>
> >      <pluginRepositories>
> >        [...]
> >      </pluginRepositories>
> >    </profile>
> >  </profiles>
> >
> > Now, if I use the explicit path of the local repository everything
> > works
> > well, instead if I use the property ${settings.localRepository} id
> > doesn't work. It seems that maven isn't able to give a value to the
> > property. I tried this profile configuration in both settings.xml and
> > pom.xml files.
> > Moreover I even tried to use different properties (e.g. ${user.dir}.
> > ${usr.home}) but in all the case I had no successful results.
> >
> > Have I missed something...?
> >
> > Is there any problem in managing properties..?
> >
> > Thanks
> >
> >
> > ---------------------------------------------------------------------
> > 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: maven properties seem not to work in profile activation feature

Posted by "Brewster, Richard" <ri...@pqa.com>.
I am not sure what you mean by "maven property".  <localRepository> is
NOT a property.  I found that while you can reference it like a property
with ${localRepository}, you do not get back the value given in the XML
element, but something different.

Perhaps my remark about using the local.repository property in profile
activation was confusing.  I don't use that property to activate a
profile; I just use it to locate artifacts in the repo.

Activating profiles with properties works just fine.  As:

        <profile>
            <id>integration-test</id>
            <activation>
                <property>
                    <name>!maven.test.skip</name>
                </property>
            </activation>
....

Richard Brewster
Senior Associate
Perrin Quarles Associates
richardbrewster@pqa.com
(434) 817-2640


-----Original Message-----
From: Arnd Kleinbeck [mailto:arnd.kleinbeck@innoq.com] 
Sent: Thursday, February 28, 2008 5:57 AM
To: Maven Users List
Cc: Brewster, Richard
Subject: Re: maven properties seem not to work in profile activation
feature

Hi Richard,

does this really work for you? I cannot manage to use a maven property
value for profile activation, neither if i declare the property in the
pom nor in settings.xml.

As far as i understand, maven property usage for activating profiles is
not supported.

The only solution - as far as i know - would be the implementation of a
custom profile activator.
Does this work for maven 2.0.8? Has anybody experiences with that?

BR Arnd

|||  Arnd Kleinbeck
|||
|||  innoQ Deutschland GmbH, Halskestr. 17, D-40880 Ratingen, Germany
|||  phone: +49 2102 77162-100, mobile: +49 163 8780130, fax: +49 2102
77160-1
|||  e-mail: arnd.kleinbeck@innoq.com, web: http://www.innoq.com



Am 16.01.2008 um 18:54 schrieb Brewster, Richard:

> I ran into this before.  The <localRepository> element is *NOT* a 
> property. Although it can be referenced like one, it does not behave 
> as expected.
>
> <localRepository>/m2/repository</localRepository>
>
> I defined my own local.repository property that duplicates the path, 
> so I could reference it.
>
> In the properties element in settings.xml:
>
> <properties>
>    <local.repository>/m2/repository</local.repository>
> .. other properties
> </properties>
> 	
> Now you can write ${local.repository} in your pom.xml and use that in 
> profile activation conditions.
>
> Richard Brewster
> Senior Associate
> Perrin Quarles Associates
> richardbrewster@pqa.com
> (434) 817-2640
>
>
> -----Original Message-----
> From: Patrizio Munzi [mailto:patrizio.munzi@eris4.com]
> Sent: Wednesday, January 16, 2008 9:00 AM
> To: users@maven.apache.org
> Subject: maven properties seem not to work in profile activation 
> feature
>
> Hi all,
>
> I'm trying to manage profiles activations/deactivations by using the 
> activation tag among with the file tag.
> What I would like to do is to activate a particular profile only if a 
> specified folder is present into the local repository.
> The profile configuration I'm using is the following:
>
>  <profiles>
>    <profile>
>      <id>apache</id>
>      <activation>
>        <activeByDefault>false</activeByDefault>
>        <file>
>
> <missing>${settings.localRepository}/org/apache/maven/plugins/maven-
> jar-
> plugin/2.2-SNAPSHOT</missing>
>        </file>
>      </activation>
>      <repositories>
>        [...]
>      </repositories>
>      <pluginRepositories>
>        [...]
>      </pluginRepositories>
>    </profile>
>  </profiles>
>
> Now, if I use the explicit path of the local repository everything 
> works well, instead if I use the property ${settings.localRepository} 
> id doesn't work. It seems that maven isn't able to give a value to the

> property. I tried this profile configuration in both settings.xml and 
> pom.xml files.
> Moreover I even tried to use different properties (e.g. ${user.dir}.
> ${usr.home}) but in all the case I had no successful results.
>
> Have I missed something...?
>
> Is there any problem in managing properties..?
>
> Thanks
>
>
> ---------------------------------------------------------------------
> 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: maven properties seem not to work in profile activation feature

Posted by Arnd Kleinbeck <ar...@innoq.com>.
Hi Richard,

does this really work for you? I cannot manage to use a maven property
value for profile activation, neither if i declare the property in the  
pom nor
in settings.xml.

As far as i understand, maven property usage for activating profiles  
is not
supported.

The only solution - as far as i know - would be the implementation of a
custom profile activator.
Does this work for maven 2.0.8? Has anybody experiences with that?

BR Arnd

|||  Arnd Kleinbeck
|||
|||  innoQ Deutschland GmbH, Halskestr. 17, D-40880 Ratingen, Germany
|||  phone: +49 2102 77162-100, mobile: +49 163 8780130, fax: +49 2102  
77160-1
|||  e-mail: arnd.kleinbeck@innoq.com, web: http://www.innoq.com



Am 16.01.2008 um 18:54 schrieb Brewster, Richard:

> I ran into this before.  The <localRepository> element is *NOT* a
> property. Although it can be referenced like one, it does not behave  
> as
> expected.
>
> <localRepository>/m2/repository</localRepository>
>
> I defined my own local.repository property that duplicates the path,  
> so
> I could reference it.
>
> In the properties element in settings.xml:
>
> <properties>
>    <local.repository>/m2/repository</local.repository>
> .. other properties
> </properties>
> 	
> Now you can write ${local.repository} in your pom.xml and use that in
> profile activation conditions.
>
> Richard Brewster
> Senior Associate
> Perrin Quarles Associates
> richardbrewster@pqa.com
> (434) 817-2640
>
>
> -----Original Message-----
> From: Patrizio Munzi [mailto:patrizio.munzi@eris4.com]
> Sent: Wednesday, January 16, 2008 9:00 AM
> To: users@maven.apache.org
> Subject: maven properties seem not to work in profile activation  
> feature
>
> Hi all,
>
> I'm trying to manage profiles activations/deactivations by using the
> activation tag among with the file tag.
> What I would like to do is to activate a particular profile only if a
> specified folder is present into the local repository.
> The profile configuration I'm using is the following:
>
>  <profiles>
>    <profile>
>      <id>apache</id>
>      <activation>
>        <activeByDefault>false</activeByDefault>
>        <file>
>
> <missing>${settings.localRepository}/org/apache/maven/plugins/maven- 
> jar-
> plugin/2.2-SNAPSHOT</missing>
>        </file>
>      </activation>
>      <repositories>
>        [...]
>      </repositories>
>      <pluginRepositories>
>        [...]
>      </pluginRepositories>
>    </profile>
>  </profiles>
>
> Now, if I use the explicit path of the local repository everything  
> works
> well, instead if I use the property ${settings.localRepository} id
> doesn't work. It seems that maven isn't able to give a value to the
> property. I tried this profile configuration in both settings.xml and
> pom.xml files.
> Moreover I even tried to use different properties (e.g. ${user.dir}.
> ${usr.home}) but in all the case I had no successful results.
>
> Have I missed something...?
>
> Is there any problem in managing properties..?
>
> Thanks
>
>
> ---------------------------------------------------------------------
> 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: maven properties seem not to work in profile activation feature

Posted by "Brewster, Richard" <ri...@pqa.com>.
I ran into this before.  The <localRepository> element is *NOT* a
property. Although it can be referenced like one, it does not behave as
expected.

<localRepository>/m2/repository</localRepository> 

I defined my own local.repository property that duplicates the path, so
I could reference it.

In the properties element in settings.xml:

<properties>
    <local.repository>/m2/repository</local.repository>
.. other properties
</properties>
	
Now you can write ${local.repository} in your pom.xml and use that in
profile activation conditions.

Richard Brewster
Senior Associate
Perrin Quarles Associates
richardbrewster@pqa.com
(434) 817-2640


-----Original Message-----
From: Patrizio Munzi [mailto:patrizio.munzi@eris4.com] 
Sent: Wednesday, January 16, 2008 9:00 AM
To: users@maven.apache.org
Subject: maven properties seem not to work in profile activation feature

Hi all,

I'm trying to manage profiles activations/deactivations by using the
activation tag among with the file tag.
What I would like to do is to activate a particular profile only if a
specified folder is present into the local repository.
The profile configuration I'm using is the following:

  <profiles>
    <profile>
      <id>apache</id>
      <activation>
        <activeByDefault>false</activeByDefault>
        <file>
          
<missing>${settings.localRepository}/org/apache/maven/plugins/maven-jar-
plugin/2.2-SNAPSHOT</missing>
        </file>
      </activation>
      <repositories>
        [...]
      </repositories>
      <pluginRepositories>
        [...]
      </pluginRepositories>
    </profile>
  </profiles>

Now, if I use the explicit path of the local repository everything works
well, instead if I use the property ${settings.localRepository} id
doesn't work. It seems that maven isn't able to give a value to the
property. I tried this profile configuration in both settings.xml and
pom.xml files.
Moreover I even tried to use different properties (e.g. ${user.dir}. 
${usr.home}) but in all the case I had no successful results.

Have I missed something...?

Is there any problem in managing properties..?

Thanks


---------------------------------------------------------------------
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