Maven
  1. Maven
  2. MNG-4226

Better detection of JAVA_HOME on Apple Mac OS X

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2.2
    • Component/s: Command Line
    • Labels:
      None

      Description

      On mac JAVA_HOME is detected by using the following code:

                 if [ -z "$JAVA_VERSION" ] ; then
                   JAVA_VERSION="CurrentJDK"
                 else
                   echo "Using Java version: $JAVA_VERSION"
                 fi
                 if [ -z "$JAVA_HOME" ] ; then
                   JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
                 fi
      

      But this does not work in collaboration with Using "Java preferences" to change the actual java version to use as "CurrentJDK" does not change once you update the "java applications" order.

      There is an alternative (at least on Leopard) for determining current java home that is based on Java Preferences by using an apple provided script. So, as a replacement fo rthe code above the following could be used.

                 if [ -z "$JAVA_HOME" ] ; then
                   JAVA_HOME=`/usr/libexec/java_home | tail -1`
                 fi
      

      Could also be taht this is teh first attempt and if fails use the current way of determining home.

        Issue Links

          Activity

          Alin Dreghiciu created issue -
          Brett Porter made changes -
          Field Original Value New Value
          Fix Version/s Issues to be reviewed for 3.x [ 13145 ]
          mahoney266 made changes -
          Attachment MNG-4226-apache-maven.patch [ 60869 ]
          Christopher Tubbs made changes -
          Attachment 0001-MNG-4226-Detect-JAVA_HOME-on-newer-Mac-OS-X.patch [ 64729 ]
          Laird Nelson made changes -
          Link This issue relates to MJAVADOC-394 [ MJAVADOC-394 ]
          Laird Nelson made changes -
          Link This issue relates to MJAVADOC-395 [ MJAVADOC-395 ]
          Jason van Zyl made changes -
          Assignee Jason van Zyl [ jason ]
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Michael Osipov made changes -
          Fix Version/s Issues to be reviewed for 3.x [ 13145 ]
          Michael Osipov made changes -
          Fix Version/s 3.2.2 [ 20042 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
          Mark Thomas made changes -
          Link This issue relates to MJAVADOC-394 [ MJAVADOC-394 ]
          Mark Thomas made changes -
          Link This issue relates to MJAVADOC-395 [ MJAVADOC-395 ]
          Mark Thomas made changes -
          Workflow jira [ 12714568 ] Default workflow, editable Closed status [ 12755549 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
          Mark Thomas made changes -
          Link This issue relates to MJAVADOC-395 [ MJAVADOC-395 ]
          Mark Thomas made changes -
          Link This issue relates to MJAVADOC-394 [ MJAVADOC-394 ]
          Mark Thomas made changes -
          Workflow jira [ 12952938 ] Default workflow, editable Closed status [ 12990271 ]
          Mark Thomas made changes -
          Assignee jason lane [ jason ] Jason van Zyl [ jvanzyl ]

            People

            • Assignee:
              Jason van Zyl
              Reporter:
              Alin Dreghiciu
            • Votes:
              12 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development