码迷,mamicode.com
首页 > 其他好文 > 详细

Maven - 实例-3-自动创建Maven目录骨架

时间:2017-12-08 23:57:35      阅读:346      评论:0      收藏:0      [点我收藏+]

标签:which   nis   plugin   generate   代码   项目   sam   mac   lte   

archetype插件用于创建符合maven规定的目录骨架

方式一:根据提示设置相关参数

guowli@5CG450158J MINGW64 /d/Anliven-Running/Zen/EclipseProjects
$ ll
total 4
drwxr-xr-x 1 guowli 1049089 0 Sep  1 16:50 Test/
drwxr-xr-x 1 guowli 1049089 0 Oct 20 17:14 TestMaven/
drwxr-xr-x 1 guowli 1049089 0 Oct 20 17:28 TestMaven02/

guowli@5CG450158J MINGW64 /d/Anliven-Running/Zen/EclipseProjects
$ mkdir TestMaven03

guowli@5CG450158J MINGW64 /d/Anliven-Running/Zen/EclipseProjects
$ cd TestMaven03

guowli@5CG450158J MINGW64 /d/Anliven-Running/Zen/EclipseProjects/TestMaven03
$ mvn archetype:generate
[INFO] Scanning for projects...
Downloading: http://central.maven.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
......
......
......
Choose archetype:
1: remote -> am.ik.archetype:maven-reactjs-blank-archetype (Blank Project for React.js)
......
......
......
1057: remote -> org.apache.maven.archetypes:maven-archetype-quickstart (An archetype which contains a sample Maven project.)
......
......
......
1962: remote -> us.fatehi:schemacrawler-archetype-plugin-lint (-)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 1057:
Choose org.apache.maven.archetypes:maven-archetype-quickstart version:
1: 1.0-alpha-1
2: 1.0-alpha-2
3: 1.0-alpha-3
4: 1.0-alpha-4
5: 1.0
6: 1.1
Choose a number: 6: 6
......
......
......
Define value for property ‘groupId‘: anliven.testmaven03
Define value for property ‘artifactId‘: testmaven03
Define value for property ‘version‘ 1.0-SNAPSHOT: : 0.0.1-SNAPSHOT
Define value for property ‘package‘ anliven.testmaven03: : anliven.testmaven03
Confirm properties configuration:
groupId: anliven.testmaven03
artifactId: testmaven03
version: 0.0.1-SNAPSHOT
package: anliven.testmaven03
 Y: : Y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.1
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: D:\Anliven-Running\Zen\EclipseProjects\TestMaven03
[INFO] Parameter: package, Value: anliven.testmaven03
[INFO] Parameter: groupId, Value: anliven.testmaven03
[INFO] Parameter: artifactId, Value: testmaven03
[INFO] Parameter: packageName, Value: anliven.testmaven03
[INFO] Parameter: version, Value: 0.0.1-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: D:\Anliven-Running\Zen\EclipseProjects\TestMaven03\testmaven03
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:25 min
[INFO] Finished at: 2017-10-20T17:56:44+08:00
[INFO] Final Memory: 17M/208M
[INFO] ------------------------------------------------------------------------

guowli@5CG450158J MINGW64 /d/Anliven-Running/Zen/EclipseProjects/TestMaven03
$ ls -l
total 0
drwxr-xr-x 1 guowli 1049089 0 Oct 20 17:56 testmaven03/

guowli@5CG450158J MINGW64 /d/Anliven-Running/Zen/EclipseProjects/TestMaven03
$ ls -l testmaven03/
total 4
-rw-r--r-- 1 guowli 1049089 790 Oct 20 17:56 pom.xml
drwxr-xr-x 1 guowli 1049089   0 Oct 20 17:56 src/

guowli@5CG450158J MINGW64 /d/Anliven-Running/Zen/EclipseProjects/TestMaven03
$ ls -l testmaven03/src/main/java/anliven/testmaven03/App.java
-rw-r--r-- 1 guowli 1049089 195 Oct 20 17:56 testmaven03/src/main/java/anliven/testmaven03/App.java

guowli@5CG450158J MINGW64 /d/Anliven-Running/Zen/EclipseProjects/TestMaven03
$ ls -l testmaven03/src/test/java/anliven/testmaven03/AppTest.java
-rw-r--r-- 1 guowli 1049089 685 Oct 20 17:56 testmaven03/src/test/java/anliven/testmaven03/AppTest.java

方式二:一次性指定相关参数

$ mvn archetype:generate -DgroupId=anliven.testmaven03 -DartifactId=testmaven03 -Dversion= 0.0.1-SNAPSHOT -Dpackage=anliven.testmaven03
  • -DgroupId=组织名,公司网址的反写+项目名
  • -DartifactId=项目名-模块名
  • -Dversion=版本号
  • -Dpackage=代码所在的包名

Maven - 实例-3-自动创建Maven目录骨架

标签:which   nis   plugin   generate   代码   项目   sam   mac   lte   

原文地址:http://www.cnblogs.com/anliven/p/8007343.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!