# maven-archetype
**Repository Path**: ofri/maven-archetype
## Basic Information
- **Project Name**: maven-archetype
- **Description**: maven archetype脚手架,补充默认脚手架创建项目后还要手动创建resources目录、创建web项目后,还需要把项目2.3换成2.5的不足。
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 16
- **Forks**: 6
- **Created**: 2016-09-02
- **Last Updated**: 2023-10-16
## Categories & Tags
**Categories**: maven-plugin
**Tags**: None
## README
# 自定义maven archetype
1. 每次创建项目后还要手动创建resources目录。
2. 每次创建web项目后,还需要把Dynamic Web Module 2.3换成2.5。
您是否正在被上面的两个问题困扰?这个项目可以帮助您解决上述问题。
## 使用方法:
1. 下载源码:
> git clone https://git.oschina.net/ofri/maven-archetype.git
2. 安装并更新本地的archetype-catalog.xml
> cd maven-archetype
> mvn install archetype:update-local-catalog
3. 在eclipse新建项目时选择Default Local类型的Catalog

## 子项目介绍
1. maven-archetype-quickstart:普通java项目
2. maven-archetype-webapp:web项目
3. maven-archetype-springmvcapp:spring mvc项目(还不完善)
## archetype项目结构说明
1. 项目文件结构

2.archetype-metadata.xml配置中fileSet属性说明
+ filtered:过滤文件中的变量,如${groupId}、${artifactId}等,值为true是,创建项目时传入的值替换对应的变量。
+ packaged:创建项目时自动创建${groupId}.${artifactId}这个包。
## 开发过程中遇到的问题及解决方法
1. 在pom中配置
```
maven-archetype
```
后出现 Unknown packaging: maven-archetype错误。
+ 解决方法:在pom的build节点下的extensions中加入
```
org.apache.maven.archetype
archetype-packaging
2.2
```
## 参考资料
+ [archetype.xml](http://maven.apache.org/guides/mini/guide-creating-archetypes.html)
+ [archetype-metadata.xml](http://maven.apache.org/archetype/index.html)
+ [apache archetype 源码](http://svn.apache.org/repos/asf/maven/archetypes/trunk)
+ [archetype catalogs](https://maven.apache.org/archetype/maven-archetype-plugin/specification/archetype-catalog.html)
+ mvn archetype:create-from-project