Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6003

Drastically reduce JAVA_HOME discovery code

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.9
    • Fix Version/s: 3.5.0-alpha-1, 3.5.0
    • Component/s: Command Line
    • Labels:
      None

      Description

      Our installation documentation several times requires that JAVA_HOME is set and points to a valid JDK. Though, tens of lines in mvn and mvn.cmd perform some magic to discover it when it is not set. This completely contradicts our requirement that JAVA_HOME must be set.

      We can drastically reduce this code by checking if JAVA_HOME is set and use it, if not perform which java and use that to run Maven. Not adhering to our requirements is deemed to undefined behavior. A developer must be able to set this simple env var properly. In most cases on Unix/Linux OpenJDK is installed anyway which means that which java points to a JDK anyway. For instance, the JAVA_HOME discovery on FreeBSD competely fails and sets it to /usr/local because /usr/local/bin/java is actually a wrapper script.

        Issue Links

          Activity

          Show
          michael-o Michael Osipov added a comment - Pushed branch: https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commitdiff;h=196234a95f7d5ade0b0b905308c2083e856cd121
          Hide
          michael-o Michael Osipov added a comment -
          Show
          michael-o Michael Osipov added a comment - Fixed with 6c4627bd463dc080cb00c01a27b4ff830cbd5702 .
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-3.x #1261 (See https://builds.apache.org/job/maven-3.x/1261/)
          MNG-6003 Drastically reduce JAVA_HOME discovery code (michaelo: rev 6c4627bd463dc080cb00c01a27b4ff830cbd5702)

          • apache-maven/src/bin/mvn
          • apache-maven/src/bin/mvn.cmd
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-3.x #1261 (See https://builds.apache.org/job/maven-3.x/1261/ ) MNG-6003 Drastically reduce JAVA_HOME discovery code (michaelo: rev 6c4627bd463dc080cb00c01a27b4ff830cbd5702) apache-maven/src/bin/mvn apache-maven/src/bin/mvn.cmd
          Hide
          stephenc Stephen Connolly added a comment -

          Maven 3.4.0 has been dropped. See this thread for more details.

          This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.

          Show
          stephenc Stephen Connolly added a comment - Maven 3.4.0 has been dropped. See this thread for more details. This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.
          Hide
          michael-o Michael Osipov added a comment -
          Show
          michael-o Michael Osipov added a comment - Fixed with 2678388ea2cebc43f58009720609523ae09176f7 .
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1532 (See https://builds.apache.org/job/maven-3.x/1532/)
          MNG-6003 Drastically reduce JAVA_HOME discovery code (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=2678388ea2cebc43f58009720609523ae09176f7)

          • (edit) apache-maven/src/bin/mvn.cmd
          • (edit) apache-maven/src/bin/mvn
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1532 (See https://builds.apache.org/job/maven-3.x/1532/ ) MNG-6003 Drastically reduce JAVA_HOME discovery code (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=2678388ea2cebc43f58009720609523ae09176f7 ) (edit) apache-maven/src/bin/mvn.cmd (edit) apache-maven/src/bin/mvn

            People

            • Assignee:
              michael-o Michael Osipov
              Reporter:
              michael-o Michael Osipov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development