5) mvn archetype:generate
获取帮助
mvn -h
命令格式
usage: mvn [options] [<goal(s)>] [<phase(s)>]
-D,--define <arg> | Define a system property |
Defines a system property. This will take priority over any other property specified.
eg.
mvn archetype:generate -D archetypeCatalog=file://E:/e/maven
mvn archetype:generate -DarchetypeCatalog=file://E:/e/maven
mvn archetype:generate --define archetypeCatalog=file://E:/e/maven
其中第二种方式较为常用
================================================================================
mvn archetype:generate
(1) 使用步骤
mvn -l E:\e\maven\log.txt archetype:generate
步骤:
1.默认为setting.xml 中的interactiveMode 交互模式
2.列出原型
3.选择原型,默认为maven-archetype-quickstart (或者过滤原型后,从结果集中重新选择原型)
4.选择version
5.定义groupId
6.定义artifactId
7.定义version
8.定义package
9.确认
备注:输入值可以覆盖默认值,不输入则以默认值为准。
(2) Optional Parameters
The archetype catalogs to use to build a list and let the user choose from. It is a comma separated list of catalogs. Catalogs use the following schemes:
- 'file://...' with archetype-catalog.xml automatically appended when pointing to a directory
- 'http://...' or 'https://...' with archetype-catalog.xml always appended
- 'local' which is the shortcut for 'file://~/.m2/archetype-catalog.xml'
- 'remote' which is the shortcut for Maven Central repository, ie 'http://repo.maven.apache.org/maven2'
- 'internal' which is an internal catalog
Since 2.0-alpha-5, default value is no longer internal,local but remote,local. If Maven Central repository catalog file is empty, internal catalog is used instead.
Default value is: remote,local.
User property is: archetypeCatalog.
说明:
该参数指定多个时以","英文逗号分割。
如果指定的是目录则自动拼接archetype-catalog.xml
不设置改参数时默认使用remote,local
当使用remote时会从maven中央仓库获取xml文件,即:http://repo.maven.apache.org/maven2/archetype-catalog.xml
中央仓库获取文件会很慢,可以用迅雷等工具下载到本地,以'file://...'形式使用
(3) archetype-catalog.xml
<?xml version="1.0" encoding="UTF-8"?>
<archetype-catalog>
<archetypes>
<archetype>
<groupId>org.apache.maven.archetypes</groupId>
<artifactId>maven-archetype-quickstart</artifactId>
<version>1.1</version>
<description>An archetype which contains a sample Maven project.</description>
</archetype>
</archetypes>
</archetype-catalog>
构建此原型时,如果本地仓库没有,会下载
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.jar (7 KB at 9.5 KB/sec)
Downloading: file://E:/e/maven/org/apache/maven/archetypes/maven-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.pom (2 KB at 5.5 KB/sec)
查看下载的pom.xml 文件
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-quickstart-1.1</connection>
<developerConnection>..此处省略..</developerConnection>
<url>http://svn.apache.org/viewvc/maven/archetype/tags/maven-archetype-quickstart-1.1</url>
</scm>
Source Control Management
代码下载地址显而易见
(4) 完整示例
最新文章
- IteratorPattern(迭代子模式)
- MySQL数据类型 int(M) 表示什么意思?详解mysql int类型的长度值问题
- iOS之tabBar随tableView的滑动而隐藏/显现
- JS无刷新分页插件
- Adobe Scout 入门
- http响应报文和http请求报文 详细信息
- File not found images\Thumbs.db.
- html5上传文件并监听进度
- SDPLR的安装过程(matlab)
- MFC中DoDataExchange()的作用
- 内容页获取当前栏目的上一级栏目ID
- docker学习端口连接docker容器---第四章节
- ubuntu彻底卸载软件
- HashMap(JDK1.8)
- Linux Centos下查看cpu、磁盘、内存使用情况,关闭MySQL日志
- 基于lfslivecd-x86-6.3-r2145安装vnc和qemu
- Zuul 限流
- Android requires compiler compliance level 5.0 or 6.0. Found &#39;1.4&#39; instead.解决方法
- springMVC学习二 原始springMVC环境搭建
- SpringBoot2+WebSocket之聊天应用实战(优化版本)