maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Syer (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MNG-5858) mvn script fails to locate .mvn in current directory
Date Thu, 16 Jul 2015 11:58:04 GMT
Dave Syer created MNG-5858:
------------------------------

             Summary: mvn script fails to locate .mvn in current directory
                 Key: MNG-5858
                 URL: https://issues.apache.org/jira/browse/MNG-5858
             Project: Maven
          Issue Type: Bug
    Affects Versions: 3.3.3
            Reporter: Dave Syer


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

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

Should be

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

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message