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

mvn script fails to locate .mvn in current directory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.3.3
    • 3.3.9
    • None
    • 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

              jvanzyl Jason van Zyl
              david_syer Dave Syer
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: