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

mvn script fails to locate .mvn in current directory

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.3
    • Fix Version/s: 3.3.9
    • Component/s: None
    • Labels:
      None

      Description

      The while loop in the shell script where we look for the .mvn directory is wrong:

      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}"
      }
      

      Should be

      find_maven_basedir() {
        local basedir=$(pwd)
        local wdir=$(pwd)
        while [ "$wdir" != '/' ] ; do
          if [ -d "$wdir"/.mvn ] ; then
            basedir=$wdir
            break
          fi
          wdir=$(cd "$wdir/.."; pwd)
        done
        echo "${basedir}"
      }
      

      That way if the current directory contains .mvn the loop terminates immediately.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jvanzyl Jason van Zyl
                Reporter:
                david_syer Dave Syer
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: