Maven 2 Archetype Plugin 应用

来源:互联网 发布:win7电脑端口怎么设置 编辑:程序博客网 时间:2024/05/03 22:01

用法
Calling mvn archetype:create-from-project  the plugin first resolves the package by guessing the project directory.
调用 mvn archetype:create-from-project,该插件首先从项目所在的目录通过猜测获取包
It then generates the directory tree of the archetype in the target generated-sources/archetype directory.
接着它会在目标文件夹target下的 generate-sources/archtype产生archetype目录树


在已有项目的根本目录,如你已有的工程 yourWorkspace/yourProject

yourProject/.project
             pom.xml
                .classpath
运行命令
mvn archetype:create-from-project

Then move to that generated directory and call mvn install  on the created archetype.
然后移到生成的目录,同时在声称的archetype调用 mvn install
$ cd target/generated-sources/archetype/
$ mvn install



Finally move to a fresh directory and use your archetype.
最后移动到一个新的目录使用你的archetype
$ mkdir /tmp/archetype
$ cd /tmp/archetype
$ mvn archetype:generate -DarchetypeCatalog=local

参考例子
mvn archetype:generate  -DarchetypeGroupId=yourCompany.yourPart -DarchetypeArtifactId=parent -DarchetypeRepository=http://xxx.xxx.xxx.xxx:8080/website -DarchetypeVersion=1.0 -DgroupId=yourCompany -DartifactId=projectId -Dversion=1.0

原创粉丝点击