Maven
  1. Maven
  2. MNG-3779

Improve error message when trying to execute mojo with no pom.xml

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.9, 2.1.0-M1
    • Fix Version/s: 3.0-beta-1
    • Component/s: Errors, Logging
    • Labels:
      None

      Description

      I've seen many users on the mailing lists or in my company who get this error message:

      Cannot execute mojo: resources. It requires a project with an existing pom.xml, but the build is not using one.

      Most often than not they do not understand what the cause of the problem is.
      Most often that not this is simply because they are 1 directory up or down relatively to the directory that contains the pom.xml of the project they want to build.

      I suggest that the error message should be updated to something like:

      Cannot execute mojo "bla". Maven was executed in directory "foo" and it doesn't contain a pom.xml

      Moreover, maven should look 1 directory up and 1 directory down from the basedir for pom.xml files. And if one is detected suggest the user to move to that directory.

        Activity

        Samuel Le Berrigaud created issue -
        Brett Porter made changes -
        Field Original Value New Value
        Fix Version/s 2.0.11 [ 14118 ]
        Brett Porter made changes -
        Fix Version/s 2.0.11 [ 14118 ]
        Fix Version/s 2.2.1 [ 15328 ]
        John Casey made changes -
        Fix Version/s 2.2.1 [ 15328 ]
        Fix Version/s 2.2.2 [ 15472 ]
        Hide
        Brett Porter added a comment -

        this confusing error is not shown in 3.0-alpha-5. However, the behaviour is now to say "build successful" against a stub project.

        I think lifecycle phases should fail in a clear way against non-existant pom.xml scenarios. The only goals that make sense without a POM are standalone ones (archetype:generate, etc.)

        Show
        Brett Porter added a comment - this confusing error is not shown in 3.0-alpha-5. However, the behaviour is now to say "build successful" against a stub project. I think lifecycle phases should fail in a clear way against non-existant pom.xml scenarios. The only goals that make sense without a POM are standalone ones (archetype:generate, etc.)
        Brett Porter made changes -
        Fix Version/s 2.2.2 [ 15472 ]
        Fix Version/s 3.0-alpha-7 [ 16087 ]
        Benjamin Bentmann made changes -
        Fix Version/s 3.0-alpha-8 [ 16088 ]
        Fix Version/s 3.0-alpha-7 [ 16087 ]
        Hide
        Benjamin Bentmann added a comment -

        Improved in r928903.

        Show
        Benjamin Bentmann added a comment - Improved in r928903 .
        Benjamin Bentmann made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Assignee Benjamin Bentmann [ bentmann ]
        Paul Benedict made changes -
        Summary Improve error message when trying to execute moojo with no pom.xml Improve error message when trying to execute mojo with no pom.xml
        Benjamin Bentmann made changes -
        Fix Version/s 3.0-beta-1 [ 16089 ]
        Fix Version/s 3.0-alpha-8 [ 16088 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
        Mark Thomas made changes -
        Workflow jira [ 12714172 ] Default workflow, editable Closed status [ 12753921 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
        Mark Thomas made changes -
        Workflow jira [ 12952899 ] Default workflow, editable Closed status [ 12990163 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        543d 22h 5m 1 Benjamin Bentmann 29/Mar/10 17:17

          People

          • Assignee:
            Benjamin Bentmann
            Reporter:
            Samuel Le Berrigaud
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development