Maven根据现有项目自定义archetype
2015-06-04 15:42
281 查看
1.项目目录下运行 mvn carchetype:create-from-project,生成的archetype位于target/generated-sources/archetype/目录
Calling mvn archetype:create-from-project the plugin first resolves the package by guessing the project directory.
It then generates the directory tree of the archetype in the target/generated-sources/archetype directory.
2.进入生成目录,执行mvn install
Then move to that generated directory and call mvn
install on the created archetype.
Calling mvn archetype:create-from-project the plugin first resolves the package by guessing the project directory.
It then generates the directory tree of the archetype in the target/generated-sources/archetype directory.
mvn archetype:create-from-project [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building project [INFO] task-segment: [archetype:create-from-project] [INFO] ------------------------------------------------------------------------ [INFO] Preparing archetype:create-from-project [INFO] No goals needed for project - skipping [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:create-from-project] [INFO] Setting default archetype's groupId: com.company [INFO] Setting default archetype's artifactId: project [INFO] Setting default archetype's version: 1.0-SNAPSHOT [INFO] Setting default groupId: com.company [INFO] Setting default artifactId: project [INFO] Setting default version: 1.0-SNAPSHOT [INFO] Setting default package: com.company.project [INFO] Archetype created in target/generated-sources/archetype [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Fri Feb 22 21:49:52 GMT 2008 [INFO] Final Memory: 10M/26M [INFO] ------------------------------------------------------------------------
2.进入生成目录,执行mvn install
Then move to that generated directory and call mvn
install on the created archetype.
$ cd target/generated-sources/archetype/ $ mvn install [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building project [INFO] task-segment: [install] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:jar] [INFO] [archetype:add-archetype-metadata] [INFO] [archetype:integration-test] [INFO] [install:install] [INFO] Installing /home/local/rafale/projects/tmp/project/target/generated-sources/archetype/target/project-1.0-SNAPSHOT.jar to /home/rafale/.m2/repository/com/company/project/1.0-SNAPSHOT/project-1.0-SNAPSHOT.jar [INFO] [archetype:update-local-catalog] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 10 seconds [INFO] Finished at: Fri Feb 22 21:51:57 GMT 2008 [INFO] Final Memory: 14M/35M [INFO] ------------------------------------------------------------------------3.新建项目,使用该archetype
$ mkdir /tmp/archetype $ cd /tmp/archetype $ mvn archetype:generate -DarchetypeCatalog=local [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:generate] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:generate] Choose archetype: 1: local -> project (project) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 1:
相关文章推荐
- 哲学家就餐问题
- 常用的SQL语句大全
- 利用Google map API 查询出当前地址的周边信息(学校,餐厅,地铁站,公交站等等)
- wamp出现You don’t have permission to access/on this server提示
- aop切入点表达式
- linux 建立域环境nis
- nscalendar
- 简单叙说 serialVersionUID 的作用 (用于笔记)
- qt中tableview的使用
- ORA-12154: TNS: 无法解析指定的连接标识符
- JSP 火星坐标及GPS坐标 转百度坐标
- Windows单机最大TCP连接数的问题
- Spring RESTFul Client – RestTemplate Example--转载
- Data Base sql server 备份数据库
- 激励话语!
- SOA(面向服务的架构)
- linux程序包管理
- 简单的sql查询优化
- INSERT INTO SELECT 和 SELECT INTO 两种表复制语句
- 存储磁盘的IOPS计算方式