Workaround for MNG-3328
authorJakub Skoczen <jakub@indexdata.dk>
Mon, 31 Mar 2014 12:22:25 +0000 (14:22 +0200)
committerJakub Skoczen <jakub@indexdata.dk>
Mon, 31 Mar 2014 12:22:25 +0000 (14:22 +0200)
Maven profile activation is buggy and evaluates criteria as an ORed list.
Thus it's impossible to match environment for jdk > 1.6 AND os.family = mac

This workaround uses the java.vm.vendor property which is 'Apple Inc.' only
for apple provided JDKs (mac only and jdk < 1.7).

pom.xml

diff --git a/pom.xml b/pom.xml
index 9306750..49e9ac9 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         </os>
       </activation>
       <properties>
-        <platform>linux</platform>
+        <platform>linux</platform> <!-- no solaris etc -->
         <packaging>so</packaging>
         <!-- yaz-config executable -->
         <yaz.config>yaz-config</yaz.config>
     </profile>
 
     <profile>
-      <!-- osx is both 'unix' and 'mac' -->
+      <!-- osx family is both 'unix' and 'mac' -->
       <id>osx</id>
       <activation>
-        <jdk>1.6</jdk>
         <os>
           <family>mac</family>
         </os>
       <properties>
         <platform>osx</platform>
         <packaging>dylib</packaging>
-        <javahOS>mac</javahOS>
-        <jdkIncludePath>${java.home}/../Headers</jdkIncludePath>
+        <javahOS>darwin</javahOS>
+        <jdkIncludePath>${java.home}/../include</jdkIncludePath>
       </properties>
       <modules>
         <module>unix</module>
     </profile>
 
     <profile>
-      <!-- osx is both 'unix' and 'mac', oracle JDK has different layout -->
-      <id>osx-oracle</id>
+      <!-- Apple JDK has a different include layout -->
+      <id>apple-jdk</id>
       <activation>
-        <jdk>[1.7,)</jdk>
-        <os>
-          <family>mac</family>
-        </os>
+        <property>
+          <name>java.vendor</name>
+          <value>Apple Inc.</value>
+        </property>
       </activation>
       <properties>
-        <platform>osx</platform>
-        <packaging>dylib</packaging>
-        <javahOS>darwin</javahOS>
-        <jdkIncludePath>${java.home}/../include</jdkIncludePath>
+        <jdkIncludePath>${java.home}/../Headers</jdkIncludePath>
       </properties>
       <modules>
         <module>unix</module>