radp Help

如何使用脚手架创建项目骨架

命令行

参数说明:

  • archetype GAV:

    • archetypeGroupId: space.x9x.radp <- 固定值

    • archetypeArtifactId: scaffold-std <- 可选列表: scaffold-std, scaffold-lite, scaffold-simple, scaffold-tiny, scaffold-starter

    • archetypeVersion: 3.16 <- 使用 2.x 或 3.x 的最新版

  • generated project GAV

    • groupId: <任意>, 默认 space.x9x

    • artifactId: <任意>, 默认 scaffold-std-demo

    • package: <任意>, 默认 space.x9x.demo

    • radpVersion: 建议与 archetypeVersion 保持一致

  • 其他

    • appPort: <任意>, 默认 8888

    • appOwner: <任意>, 默认 x9x

    • appEmail: <任意>, 默认 xozoz.sos@gmail.com

准备工作(推荐)

那么,我们就可以通过下面这种方式, 实现自由切换.

<profiles> <profile> <id>repo-central</id> <repositories> <repository> ...其它仓库 </repository> <repository> <id>archetype</id> <url>https://artifactory.example.com/artifactory/maven-public-virtual</url> </repository> </repositories> </profile> <profile> <id>repo-artifactory</id> <repositories> <repository> <id>archetype</id> <url>https://repo.maven.apache.org/maven2</url> </repository> </repositories> </profile> </profiles>

非交互模式

  • -Prepo-artifactory: 将会去 artifactory 下载 archetype-catalog.xml

  • -Prepo-central: 将会去 maven central 下载 archetype-catalog.xml

mvn -Prepo-artifacty archetype:generate \ -DarchetypeGroupId=space.x9x.radp \ -DarchetypeArtifactId=scaffold-std \ -DarchetypeVersion=3.16 \ -DgroupId=space.x9x.labs \ -DartifactId=scaffold-std-demo \ -Dpackage=space.x9x.demo \ -DappName=scaffold-std-demo \ -DradpVersion=3.16 \ -DappPort=8888 \ -DappOwner=x9x \ -DappEmail=xozoz.sos@gmail.com \ -DinteractiveMode=false

交互模式

mvn -Prepo-artifactory archetype:generate
  • 执行上面命令后, 根据交互提示, 输入对应值即可

老版本 maven-archetype-plugin

  • internal: 只使用插件自带的少量官方 archetype 列表

  • local: 只扫描本地 ~/.m2/repository 下已有的 archetype-catalog.xml

  • remote: 只读取远程中央仓库目录的 archetype-catalog.xml

  • URL: 使用你指定的任意 HTTP/HTTPS/file 地址上的 archetype-catalog.xml (maven-archetype-plugin >= 3.0 不在允许使用 URL)

mvn archetype:generate \ -DarchetypeCatalog=https://xxx/archetype-catalog.xml \ -DarchetypeGroupId=space.x9x.radp \ -DarchetypeArtifactId=scaffold-std \ -DarchetypeVersion=2.16 \ -DgroupId=space.x9x.labs \ -DartifactId=scaffold-std-demo \ -DappName=scaffold-std-demo \ -DradpVersion=2.16 \ -DappPort=8888 \ -DappOwner=x9x \ -DappEmail=xozoz.sos@gmail.com \ -DinteractiveMode=false
Last modified: 11 April 2025