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 ...
随机推荐
- 类定义,创建/销毁OC对象
类定义 1 OC类分为2个文件,一个是.h文件,一个是.m文件: 2 .h文件存放类.函数声明: 3 .m文件类的具体实现: 4 类声明使用关键字@interface.@end来声明: 5 类实现使用 ...
- while
public class TestWhile { /** * 测试循环 */ public static void main(String[] args) { int a=1; while(a< ...
- Ansible 书写我的playbook
mysql 创建数据库 - hosts: localhost remote_user: root tasks: - name: test mysql mysql_db: name: ...
- mysql mapper中增删查改
//1.增 public int insert(Port port) ; //2.删 public int deleteM(String id);//3.改 public int update(Por ...
- RegExp.$1 简单理解
RegExp 是javascript中的一个内置对象.为正则表达式.RegExp.$1是RegExp的一个属性,指的是与正则表达式匹配的第一个 子匹配(以括号为标志)字符串, 以此类推,RegExp. ...
- 300最长上升子序列 · Longest Increasing Subsequence
[抄题]: 往上走台阶 最长上升子序列问题是在一个无序的给定序列中找到一个尽可能长的由低到高排列的子序列,这种子序列不一定是连续的或者唯一的. 样例 给出 [5,4,1,2,3],LIS 是 [1,2 ...
- access数据库收缩(压缩)
一般是因为表中有大量没用的数据,把没用的数据全部删除 菜单栏的“工具”——“数据库实用工具”——“压缩和修复数据库” OK啦
- 7-找了一上午的BUG
#include <iostream>#include <cstring>#include <algorithm>#define MAX 1<<28;u ...
- 通过html5 的EventSource来进行数据推送
以往我们要获取服务器的数据更新,一般通过ajax的定时请求,不过这样效率就低了.我们通过html5的EventSource可以很方便的获取服务器的数据更新,不过IE好像不支持. 例1如下: ind ...
- ef linq 访问视图返回结果重复
根据检测到的语句查询和linq查询出来的结果不一致,linq查询出重复的数据,原因不明,已改用ef直接查询视图,也许以后某一天突然就解决了,先mark下.