---
title: "Maven 生成 archetype"
author: "oracle_api"
date: "2014-01-19T14:55:37Z"
tags: []
categories: ["开源软件"]
slug: "maven-archetype"
draft: false
lastmod: "2014-01-19T14:55:37Z"
id: 2007059
url: "https://oracle-api.iteye.com/blog/2007059"
---

参考文件：

Creating an archetype from an existing project:
http://maven.apache.org/archetype/maven-archetype-plugin/advanced-usage.html

Create an archetype from a multi-module project：
http://maven.apache.org/archetype/maven-archetype-plugin/examples/create-multi-module-project.html


Steps:
1.进入项目目录（pom.xml所在的目录），运行命令
mvn archetype:create-from-project
在目录target/generated-sources/archetype下生成archetype文件

2.移动到目录target/generated-sources/archetype，运行命令
mvn install
上传archetype文件到本地仓库

3.如何已生产的archetype创建新文件， 创建新的项目文件夹，然后运行
mvn archetype:generate -DarchetypeCatalog=local
