bash - mvn 命令返回 : [ERROR] The goal you specified requires a project to execute but there is no POM in this directory

标签 bash maven maven-archetype

使用 archetype:generate 以与 Maven in 5 Minutes 中所述相同的方式创建项目。
得到这个错误:

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/mnt/c/Users/etomort/quartz-poc). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (/mnt/c/Users/etomort/quartz-poc). Please verify you invoked Maven from the correct directory.

既然是这么基本的东西,我就糊涂了……

我查了这两个问题:
  • Error “The goal you specified requires a project to execute but there is no POM in this directory” after executing maven command
  • maven generating pom file

  • 但是接受的答案都没有解决这个问题。
    所以,我正在创建这个问题,以防有人一开始就没有得到它。

    顺便说一下,输入的Maven命令是:
    mvn archetype:generate -DgroupId=com.mycompany -DartifactId=quartz-poc -DarchetypeArtifactId= maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false  
    

    最佳答案

    如果您使用 Windows 并使用 cmd 命令行或 PowerShell ,则需要将参数用引号括起来:

    mvn archetype:generate "-DgroupId=com.mycompany" "-DartifactId=quartz-poc" "-DarchetypeArtifactId=maven-archetype-quickstart" "-DarchetypeVersion=1.4" "-DinteractiveMode=false"
    
    在某些机器上,它虽然没有 cmd 上的引号。

    关于bash - mvn 命令返回 : [ERROR] The goal you specified requires a project to execute but there is no POM in this directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60234708/

    相关文章:

    multithreading - 捕获异步 bash 命令的输出?

    android - “adb”未被识别为命令

    string - 在 Bash 中用另一个字符替换一个字符

    java - -Xlint :rawtypes not working in Maven

    java - 如何为 openimaj 创建 pom.xml?

    maven - 使用原型(prototype)插件在项目目录中创建文件

    Maven 原型(prototype)目录 : specify custom location(s)

    bash - ash 是否具有与 bash 的 'nullglob' 选项等效的选项?

    java - Kafka 生产者异常 NoClassDefFoundError

    java - Maven Archetype 上的 charsetName 引起的 MojoFailureException