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) 完整示例
5) mvn archetype:generate的更多相关文章
- 使用mvn archetype:generate生产maven工程,响应很慢
经常到下列时就不往下走了. 解决方案: 1.不使用interactive mode方式,直接指定DarchetypeArtifactId 2.仍使用interactive mode方式,但增加参数 - ...
- mvn archetype:create和mvn archetype:generate
create is deprecated in maven 3.0.5 and beyond,在maven3.0.5以上版本舍弃了create,使用generate生成项目 before:mvn ar ...
- idea新建maven项目时,mvn archetype:generate 速度缓慢
原文 idea新建maven项目时,mvn archetype:generate 速度缓慢 1 现象: 用IDEA新建maven项目,填写完各种参数,创建时,控制台卡在“[INFO] Generati ...
- 通过mvn archetype:generate创建Maven项目模板慢的问题
通过mvn archetype:generate这种交互方式来创建Maven项目模板的时候,经常会长时间卡在Generating project in Interactive mode这一行提示(图1 ...
- mvn archetype:generate 创建Maven项目
mvn archetype:generate 创建Maven项目 mvn compile 编译源代码 mvn deploy 发布项目 mvn test-compile 编译测试源代码 mvn test ...
- 使用mvn archetype:generate快速建立Maven项目目录结构
1.mvn archetype:generate 按照提示进行选择,默认选的话可以直接按回车键 2.mvn archetype:generate -DgroupId=组织名,公司网址的反写+项目名 ...
- Maven实战错误笔记:使用mvn archetype:generate报错:Unable to add module to the current project as it is not of packaging type 'pom'
在使用mvn archetype:generate生成Maven实战03:HelloWorld中的HelloWorld的项目骨架时报了这个错,从字面上分析是可能与pom.xml文件有关,然后我看了一下 ...
- idea maven mvn archetype:generate 速度缓慢问题(转)
From:https://my.oschina.net/u/225373/blog/468035 maven 骨架生成项目速度慢的令人发指,都在Generating project in Batc ...
- maven archetype:generate 命令简化项目模板数量
在maven里使用 mvn archetype:generate 来创建项目是十分方便的,但有时也不尽然.在网络不好时,从网络上加载 archetype-catalog.xml文件(http://re ...
随机推荐
- tensorflow UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
tensorflow读取图像出现错误:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid s ...
- JSP复习(part 4)
3.5.2 重定向网页 使用response对象中的sendRedirect()方法实现一个重定向到另一个页面. 例如: response.sendRedirect(“”login_ok.jsp“”) ...
- 代理URI和服务器URI的不同
[代理URI和服务器URI的不同] 1.向Web服务器直接发送请求时,路径为相对路径(不包含域名). 2.当向代理发送请求时,路径为绝对路径(包含域名). 参考<HTTP权威指南>6.5. ...
- JS中如何处理多个ajax并发请求?
js中的多并发处理. 通常 为了减少页面加载时间,先把核心内容显示处理,页面加载完成后再发送ajax请求获取其他数据 这时就可能产生多个ajax请求,为了用户体验,最好是发送并行请求,这就产生了并发问 ...
- 140. Word Break II (String; DP,DFS)
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each ...
- Selenium原理初步--Android自动化测试学习历程
章节:自动化基础篇——Selenium原理初步(第五讲) 注:其实所有的东西都是应该先去用,但是工具基本都一样,底层都是用的最基础的内容实现的,测试应该做的是: (1)熟练使用工具,了解各个工具的利弊 ...
- Java计算图的匹配率
2016-07-02 大概意思就是这样了,代码里我貌似没有计算最后一步,但是原理都是一样的.....R1有5个点P1有四个点,他们共同的点是4个,那就是共同点4*4/(R1的5个点*P1的四个点就是0 ...
- runloop - 面试题
2.
- haproxy 学习
https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4-option%20tcp-check https://www.hapro ...
- nginx 反向代理 502 Bad Gateway
查看nginx的error.log日志文件发现如下信息: upstream sent too big header while reading response header from upstrea ...