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

mvn shell script fails with syntax error on Solaris 10

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.3.3
    • 3.5.0-alpha-1, 3.5.0
    • Command Line
    • None
    • Solaris 10

    Description

      The $(cmd) idiom is used extensively in bin/mvn from lines 199-220, but this is not supported by older incarnations of /bin/sh (used on the shebang line). The `cmd` idiom is slightly more portable, and looks like it can probably be directly substituted.

      find_maven_basedir() {
        local basedir=$(pwd)
        local wdir=$(pwd)
        while [ "$wdir" != '/' ] ; do
          wdir=$(cd "$wdir/.."; pwd)
          if [ -d "$wdir"/.mvn ] ; then
            basedir=$wdir
            break
          fi
        done
        echo "${basedir}"
      }
      
      # concatenates all lines of a file
      concat_lines() {
        if [ -f "$1" ]; then
          echo "$(tr -s '\n' ' ' < "$1")"
        fi
      }
      
      export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
      MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
      

      See MNG-5658 for an earlier case of a similar problem.

      Attachments

        Issue Links

          Activity

            People

              michael-o Michael Osipov
              zacthompson Zac Thompson
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: