您的位置:首页 > 其它

Maven 2 Archetype Plugin 应用

2009-12-07 12:28 190 查看
用法

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: