Maven 原型生成拉更新的或最新的模板

Maven archetype generate pull newer or latest templates

我们可以使用 maven 来生成项目模板 mvn archetype:generate 然后选择一个原型编号。如果说我选择数字 1977 1977: remote -> org.springframework.boot:spring-boot-sample-tomcat-archetype (Spring Boot Tomcat Sample)。 Maven 将生成 java 项目等等。

当我检查 pom.xml 文件时,我看到

<parent>
        <!-- Your own application should inherit from spring-boot-starter-parent -->
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.0.2.RELEASE</version>
</parent>

spring-boot-starter-parent 版本 1.0.2.RELEASE 似乎是 2014 年 4 月的版本。现在是 2019 年,已经很老了。 https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent

我的maven版本是:apache-maven-3.5.4.

我们如何从 maven 获得更新的template/archetype?

您可以在 github 上找到更新的样本:

https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-tomcat

但是,我认为 springboot 已经停止使用原型,转而使用 Spring Initializr

在那里你可以选择你想要的任何版本并添加一个 Web 依赖项以包含 Tomcat 和 MVC 框架启动器。