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

mvn -f complains about illegal readlink option under macOS

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.0-alpha-1, 3.5.0-beta-1
    • Fix Version/s: 3.5.0
    • Component/s: Command Line
    • Labels:
      None
    • Environment:

      Description

      This is a regression from Maven 3.3.9. With 3.5.0-alpha-1, using mvn -f under OS X causes the following error to be printed out (similar to MNG-5688), before the command proceeds (AFAICT) without error:

      > mvn clean package -f releng/repository/pom.xml
      readlink: illegal option -- f
      usage: readlink [-n] [file ...]
      usage: dirname path
      [INFO] Scanning for projects...
      

      FWIW, I don’t get this error on a normal mvn clean package without the -f parameter.

        Activity

        Hide
        stephenc Stephen Connolly added a comment -

        how about

                basedir="$(cd "$(dirname "${arg}")" && pwd -P)"
        
        Show
        stephenc Stephen Connolly added a comment - how about basedir= "$(cd " $(dirname "${arg}" ) " && pwd -P)"
        Hide
        stephenc Stephen Connolly added a comment -

        Seems to work on quick tests that I have done on macOS and linux... I'll leave it up to the shell experts to decide if it is the best solution

        (the alternative would be to add specific uname detection for macOS and then use this command on macOS only (and use the existing

        basedir=$(dirname "$(readlink -f "${arg}")")
        

        for other unixes - note I think there is a missing layer of quotes in that form too)

        Show
        stephenc Stephen Connolly added a comment - Seems to work on quick tests that I have done on macOS and linux... I'll leave it up to the shell experts to decide if it is the best solution (the alternative would be to add specific uname detection for macOS and then use this command on macOS only (and use the existing basedir=$(dirname "$(readlink -f " ${arg} ")" ) for other unixes - note I think there is a missing layer of quotes in that form too)
        Hide
        stephenc Stephen Connolly added a comment -

        Included in my fix for MNG-6195

        Show
        stephenc Stephen Connolly added a comment - Included in my fix for MNG-6195
        Hide
        stephenc Stephen Connolly added a comment -

        87cf1eeb7d2506e192da77f7d5b286fae2b20314

        Show
        stephenc Stephen Connolly added a comment - 87cf1eeb7d2506e192da77f7d5b286fae2b20314

          People

          • Assignee:
            stephenc Stephen Connolly
            Reporter:
            sewe Andreas Sewe
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development