【问题标题】:-DarchetypeArtifactId=maven-archetype-quickstart works but -DarchetypeArtifactId=maven-archetype-webapp does not?-DarchetypeArtifactId=maven-archetype-quickstart 有效,但 -DarchetypeArtifactId=maven-archetype-webapp 无效?
【发布时间】:2018-08-11 20:55:30
【问题描述】:

我正在看一个教程,这个语句完全适用于讲师的计算机/cmd:

mvn archetype:generate -DgroupdId=com.newApp -DartifactId=sampleWeb -DarchetypeArtifactId=maven-archetype-webapp -DinterfaceMode=false

此外,-DarchetypeArtifactId=maven-archetype-quickstart 也是如此。

但是,这无法在 mine:maven-archetype-webapp 上运行,但 maven-archetype-quickstart 在我的上运行。任何线索为什么?我该怎么办?

感谢大家的回答!

【问题讨论】:

  • 命令失败时是否有错误信息?如果是,请将其添加到您的问题中。添加教程的链接是个好主意。
  • 是的,这是旧教程的问题。它们已经过时了,创建教程的人通常没有动力重新制作它们。

标签: java maven


【解决方案1】:

我发现新版本的Maven可能需要在命令中提及archetype的版本。

因此,需要在命令中(任何地方)添加“-DarchetypeVersion=1.3”,然后它才会运行。特别是如果您遇到 BUILD FAILURE 为:

" 所需的原型不存在 (org.apache.maven.archetypes:maven-archetype-webapp:1.0) -> [Help 1] "

因此命令应该是这样的: mvn archetype:generate -DgroupId=com.lynda -DartifactId=sampleWeb -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.3

参考:在https://maven.apache.org/archetypes/maven-archetype-webapp/查看用法

【讨论】:

    【解决方案2】:

    您可以通过 ma​​ven-archetype-webapp archetypeArtifactId 的链接跟踪不同的 ArchetypeVersion: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-webapp/

    这是我用过的:

    mvn archetype:generate -DgroupId=com.pluralsight.javaee-getting-started -DartifactId=bookstore-back -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.4 -DinteractiveMode=false -Dpackage=com.pluralsight.bookstore
    

    【讨论】:

      猜你喜欢
      • 2013-11-30
      • 2017-02-25
      • 1970-01-01
      • 2011-03-03
      • 2013-07-31
      • 1970-01-01
      • 2022-12-20
      • 2015-10-14
      • 1970-01-01
      相关资源
      最近更新 更多