Error “The goal you specified requires a project to execute but there is no POM in this directory” after executing maven command

后端 未结 15 1230
南笙
南笙 2020-12-02 11:29

I have a pom.xml in C:\\Users\\AArmijos\\Desktop\\Factura Electronica\\MIyT\\componentes-1.0.4\\sources\\pom.xml and I executed:

mv         


        
相关标签:
15条回答
  • 2020-12-02 12:07

    In my case, its because I copied pasted the command from the browser and it turned out that the dash was not the ASCII dash, just delete and type the dash again.

    http://www.toptip.ca/2017/04/maven-most-weird-error-causing-failure.html

    0 讨论(0)
  • 2020-12-02 12:08

    Changing mvn clean to mvn clean --file *.pom fixed this issue for me.

    0 讨论(0)
  • 2020-12-02 12:13
    • The execution of maven command required pom.xml file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.

    • Make sure that porject should contains pom.xml at the root level.

    0 讨论(0)
  • 2020-12-02 12:14

    Adding one more answer for Windows users. If none of this solves the problems.

    Do not add space before or after =

    -DgroupId= com.company.module //Wrong , Watch the space after the equal to 
    -DgroupId=com.company.module //Right 
    

    Its better to put everything inside double quotes, like "-DgroupId=com.." This will give you exact error rather than some random error.

    Weird that , maven does not even care to mention this in the documentation.

    0 讨论(0)
  • 2020-12-02 12:15

    I got this error suddenly in Netbeans (but it worked from the command line) and it turns out some other program had changed the default directory of the command prompt. And because Netbeans runs "cmd /c" when invoking maven, it starts in an incorrect directory.

    Check out in Regedit the value for

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\Autorun  
    

    If it has been set, you probably should remove it to fix the problem. (1)

    (I landed here when trying to resolve this issue, might not be 100% applicable to the current question - but might help others)

    (1) Changing default startup directory for command prompt in Windows 7

    0 讨论(0)
  • 2020-12-02 12:16

    "The goal you specified requires a project to execute": The answer is in your question. I faced the same issue. Run the "mvn command" within the project folder, Also make sure sure its a maven configured project and hence contains the "POM.xml" file and you should be good to go!

    0 讨论(0)
提交回复
热议问题