You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thorsten Möller <Th...@unibas.ch> on 2007/12/11 11:31:08 UTC

Profile activation based on JDK version

Hi,

my question is regarding activation of profiles based on the <jdk> tag.
Assume that a POM  specifies two profiles, one that should trigger for JDK
1.5.x and one for JDK 1.6.x. The POM would look like this:
<profile>
    <activation>
        <jdk>1.5</jdk>
    </activation>
...
</profile>

<profile>
    <activation>
        <jdk>1.6</jdk>
    </activation>
...
</profile>



Based on the documentation that is available from the Maven Web site it is
unclear to me what the exact semantic of the <jdk> tag is: will it be
activated for i) all major Versions greather or equal than the one specified
including sub versions or ii) only for the exact major version and all
subversions. In other words, will a <jdk>1.5</jdk> trigger only for 1.5.y
versions or also for 1.6.x, 1.7.x, ...? Provided that the latter one holds
my question then would be "how can I create two profiles -- one for 1.5.x
and one for 1.6.x -- and make sure that always only one gets activated
exclusively"?



Thanks for yor help,

Thorsten 


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


Re: Profile activation based on JDK version

Posted by Jeff MAURY <je...@jeffmaury.com>.
On 12/11/07, Thorsten Möller <Th...@unibas.ch> wrote:
>
> Hi,
>
> my question is regarding activation of profiles based on the <jdk> tag.
> Assume that a POM  specifies two profiles, one that should trigger for JDK
> 1.5.x and one for JDK 1.6.x. The POM would look like this:
> <profile>
>    <activation>
>        <jdk>1.5</jdk>
>    </activation>
> ...
> </profile>
>
> <profile>
>    <activation>
>        <jdk>1.6</jdk>
>    </activation>
> ...
> </profile>
>
>
>
> Based on the documentation that is available from the Maven Web site it is
> unclear to me what the exact semantic of the <jdk> tag is: will it be
> activated for i) all major Versions greather or equal than the one
> specified
> including sub versions or ii) only for the exact major version and all
> subversions. In other words, will a <jdk>1.5</jdk> trigger only for 1.5.y
> versions or also for 1.6.x, 1.7.x, ...? Provided that the latter one holds
> my question then would be "how can I create two profiles -- one for 1.5.x
> and one for 1.6.x -- and make sure that always only one gets activated
> exclusively"?



If you target only two different JDKs, you can use the ! notation so your
POM will be:

<profile>
   <activation>
       <jdk>1.5</jdk>
   </activation>
...
</profile>

<profile>
   <activation>
       <jdk>!1.5</jdk>
   </activation>
...
</profile>

Also from my experience, the fist profile wil not be activated if you run
Maven with a 1.5 or more JDK.

Jeff


Thanks for yor help,
>
> Thorsten
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com

Re: Profile activation based on JDK version

Posted by Tim Moore <tm...@atlassian.com>.
On Dec 11, 2007, at 2:31 AM, Thorsten Möller wrote:

> Based on the documentation that is available from the Maven Web site  
> it is
> unclear to me what the exact semantic of the <jdk> tag is: will it be
> activated for i) all major Versions greather or equal than the one  
> specified
> including sub versions or ii) only for the exact major version and all
> subversions. In other words, will a <jdk>1.5</jdk> trigger only for  
> 1.5.y
> versions or also for 1.6.x, 1.7.x, ...? Provided that the latter one  
> holds
> my question then would be "how can I create two profiles -- one for  
> 1.5.x
> and one for 1.6.x -- and make sure that always only one gets activated
> exclusively"?


According to <http://maven.apache.org/guides/introduction/introduction-to-profiles.html 
 > it matches the prefix of the JDK version, so 1.5 will match 1.5.0,  
1.5.0_13, 1.5.1, etc. but not 1.6.
--
Tim Moore / tmoore@atlassian.com
ATLASSIAN - http://www.atlassian.com
Our products help over 8,500 customers in more than 95 countries to  
collaborate




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