[ https://issues.apache.org/jira/browse/MNG-5858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14629621#comment-14629621 ]
ASF GitHub Bot commented on MNG-5858: ------------------------------------- GitHub user dsyer opened a pull request: https://github.com/apache/maven/pull/58 Locate .mvn in current directory There was a problem with the logic in the while loop that detects the base dir - it should first look in the current directory, otherwise you can't build in a directory with local settings because it will always climb up and find .mvn in a parent directory (e.g. user's home). Fixes MNG-5858 You can merge this pull request into a Git repository by running: $ git pull https://github.com/dsyer/maven fix/basedir Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven/pull/58.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #58 ---- commit 6da2911c5fc5f1deb4b1ef5d617e091005169933 Author: Dave Syer <ds...@pivotal.io> Date: 2015-07-16T11:58:58Z Locate .mvn in current directory There was a problem with the logic in the while loop that detects the base dir - it should first look in the current directory, otherwise you can't build in a directory with local settings because it will always climb up and find .mvn in a parent directory (e.g. user's home). Fixes MNG-5858 ---- > 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)