Maven
  1. Maven
  2. MNG-2376

Have Java code output Java version, not the shell script

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.7
    • Component/s: Command Line
    • Labels:
      None
    • Environment:
      Mac OS X 10.4
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      The shell script outputs $JAVA_VERSION. In my case, in an ill-fated attempt to get maven to use JDK 1.4, this was set to 1.4 but JAVA_HOME was already set (in .profile or wherever) to that of the current JDK (1.5). So it is inconsistent and led me on a wild goose chase to track down a problem. If Maven is going to output the java version, do it from java code using the right system property. Only use JAVA_VERSION to help select a JAVA_HOME, if JAVA_HOME isn't set.

      Perhaps there is some standard approach to this sort of thing but I am unsure.

        Issue Links

          Activity

          Hide
          John Casey added a comment -

          Can you provide more information on what exactly the problem is? The above description is a bit confusing.

          Show
          John Casey added a comment - Can you provide more information on what exactly the problem is? The above description is a bit confusing.
          Hide
          David Smiley added a comment -

          On Darwin (Mac OS X), alter the mvn.sh script such that JAVA_VERSION is not consulted at all if JAVA_HOME is specified.

          For example, like so (not tested):
          {{
          if [ -z "$JAVA_HOME" ] ; then

          if [ -z "$JAVA_VERSION" ] ; then
          JAVA_VERSION="CurrentJDK"
          else
          echo "Using Java version: $JAVA_VERSION"
          fi

          JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/$

          {JAVA_VERSION}

          /Home

          fi
          }}

          Additionally... you might want the Java code that handles mvn -v to output the Java version in effect, in addition to the Maven version.

          Show
          David Smiley added a comment - On Darwin (Mac OS X), alter the mvn.sh script such that JAVA_VERSION is not consulted at all if JAVA_HOME is specified. For example, like so (not tested): {{ if [ -z "$JAVA_HOME" ] ; then if [ -z "$JAVA_VERSION" ] ; then JAVA_VERSION="CurrentJDK" else echo "Using Java version: $JAVA_VERSION" fi JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/$ {JAVA_VERSION} /Home fi }} Additionally... you might want the Java code that handles mvn -v to output the Java version in effect, in addition to the Maven version.
          Hide
          brianfox brianfox added a comment -

          $ mvn --version
          Maven version: 2.0.7-SNAPSHOT
          Java version: 1.5.0_11
          OS Name: "windows xp" Version: "5.1" Arch: "x86"

          Show
          brianfox brianfox added a comment - $ mvn --version Maven version: 2.0.7-SNAPSHOT Java version: 1.5.0_11 OS Name: "windows xp" Version: "5.1" Arch: "x86"

            People

            • Assignee:
              brianfox brianfox
              Reporter:
              David Smiley
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: