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

mvn -f outputs invalid error when specifying POM directory

    Details

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

      Description

      Basic multi-module project: common, client, and server modules.

      $ mvn -f client package
      POM file client specified with the -f/--file command line argument does not exist
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building alternate-pom-client 1.0
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ alternate-pom-client ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /Users/cgould/dev/personal/alternate-pom/client/src/main/resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ alternate-pom-client ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ alternate-pom-client ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /Users/cgould/dev/personal/alternate-pom/client/src/test/resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ alternate-pom-client ---
      [INFO] No sources to compile
      [INFO]
      [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ alternate-pom-client ---
      [INFO] No tests to run.
      [INFO]
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ alternate-pom-client ---
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.764 s
      [INFO] Finished at: 2017-04-29T14:03:22-04:00
      [INFO] Final Memory: 11M/309M
      [INFO] ------------------------------------------------------------------------
      

      There is an error message, but the client module proceeds to build nonetheless.

      I don't see the error message when I run:

      $ mvn -f client/pom.xml package
      

      I've verified it doesn't happen on 3.3.9, but it does happen on 3.5.0 and 3.5.0-alpha-1.

      Sample project attached.

      1. alternate-pom.zip
        7 kB
        Charles Gould

        Issue Links

          Activity

          Hide
          cgould Charles Gould added a comment -

          Possibly related to MNG-6191 and MNG-6198?

          Show
          cgould Charles Gould added a comment - Possibly related to MNG-6191 and MNG-6198 ?
          Hide
          hboutemy Hervé Boutemy added a comment - - edited

          nice finding: yes, looks like the shell script does not check when argument is a directory instead of a file

          there is MNG-5889 core IT to improve to add this case, in addition to fixing the script itself, so this bug does never gets reintroduced: do you want to try to do the fix?

          Show
          hboutemy Hervé Boutemy added a comment - - edited nice finding: yes, looks like the shell script does not check when argument is a directory instead of a file there is MNG-5889 core IT to improve to add this case, in addition to fixing the script itself, so this bug does never gets reintroduced: do you want to try to do the fix?
          Hide
          cgould Charles Gould added a comment -

          Hervé Boutemy Yesterday I grepped Maven Core for the warning message, but I couldn't find it. Was I looking in the wrong repo?

          Show
          cgould Charles Gould added a comment - Hervé Boutemy Yesterday I grepped Maven Core for the warning message, but I couldn't find it. Was I looking in the wrong repo?
          Hide
          hboutemy Hervé Boutemy added a comment -

          the message is not in java code but in mvn shell script, in apache-maven/src/bin
          it is related to MNG-5889: that's why the IT is in https://git-wip-us.apache.org/repos/asf?p=maven-integration-testing.git, in core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889FindBasedir.java and core-it-suite/src/test/resources/mng-5889-find.mvn/

          Show
          hboutemy Hervé Boutemy added a comment - the message is not in java code but in mvn shell script, in apache-maven/src/bin it is related to MNG-5889 : that's why the IT is in https://git-wip-us.apache.org/repos/asf?p=maven-integration-testing.git , in core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5889FindBasedir.java and core-it-suite/src/test/resources/mng-5889-find.mvn/
          Hide
          cgould Charles Gould added a comment -

          I've since looked at mvn and identified the issue there. It's using

          if [ -f "${arg}" ]
          

          instead of

          if [ -a "${arg}" ]
          

          But mvn.cmd is a bit different (lots of gotos).

          Just to be clear – if I'm to submit a patch, it should cover mvn, mvn.cmd, and the integration tests as well, correct?

          Show
          cgould Charles Gould added a comment - I've since looked at mvn and identified the issue there. It's using if [ -f "${arg}" ] instead of if [ -a "${arg}" ] But mvn.cmd is a bit different (lots of gotos). Just to be clear – if I'm to submit a patch, it should cover mvn , mvn.cmd , and the integration tests as well, correct?
          Hide
          hboutemy Hervé Boutemy added a comment -

          ideally, it should cover everything, yes: the IT to have some tests (and check if it is affected by the issue or not), then the fix(es)
          if you are not able to provide everything, doing what you can is better than relying only on others

          Show
          hboutemy Hervé Boutemy added a comment - ideally, it should cover everything, yes: the IT to have some tests (and check if it is affected by the issue or not), then the fix(es) if you are not able to provide everything, doing what you can is better than relying only on others
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1648 (See https://builds.apache.org/job/maven-3.x/1648/)
          MNG-6223 support -f path/to/dir when detecting .mvn (hboutemy: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=2d4401557c3c870409e8b1c65d2dcc9a68281cae)

          • (edit) apache-maven/src/bin/mvn.cmd
          • (edit) apache-maven/src/bin/mvn
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1648 (See https://builds.apache.org/job/maven-3.x/1648/ ) MNG-6223 support -f path/to/dir when detecting .mvn (hboutemy: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=2d4401557c3c870409e8b1c65d2dcc9a68281cae ) (edit) apache-maven/src/bin/mvn.cmd (edit) apache-maven/src/bin/mvn
          Hide
          hboutemy Hervé Boutemy added a comment -
          Show
          hboutemy Hervé Boutemy added a comment - fixed both on Windows and Unix IT in http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/981a8104
          Hide
          jglick@netbeans.org Jesse Glick added a comment -

          Was a regression of MNG-5338.

          Show
          jglick@netbeans.org Jesse Glick added a comment - Was a regression of MNG-5338 .
          Hide
          hboutemy Hervé Boutemy added a comment -

          thank you for the reference: now we did a core IT, we won't have regression on this in the future

          Show
          hboutemy Hervé Boutemy added a comment - thank you for the reference: now we did a core IT, we won't have regression on this in the future
          Hide
          cgould Charles Gould added a comment -

          Thanks for getting this fix into 3.5.2!

          Show
          cgould Charles Gould added a comment - Thanks for getting this fix into 3.5.2!

            People

            • Assignee:
              hboutemy Hervé Boutemy
              Reporter:
              cgould Charles Gould
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development