1. 从project创建archetype

在项目根目录下,运行

mvn archetype:create-from-project  

创建的archetype工程在app_folder/target/generated-sources/archetype 目录下,其中archetype-resources包含用来创建原型项目的文件,META-INF/maven/archetype-metadata.xml
是用来对文件结构进行详细描述的源文件。

2. Archetype的一些built-in参数

Variable Meaning
__rootArtifactId__ 做文件夹名替换用,例如__rootArtifactId__-dal
${rootArtifactId} Already explained above, it holds the value entered by the user as the project name (the value that maven ask as the artifactId: in
the prompt when the user runs the archetype)
${artifactId} If your project is composed by one module, this variable will have the same value as ${rootArtifactId}, but if the project contains
several modules, this variable will be replaced by the module name inside every module folder, for example: given a module named portlet-domain inside a project namedportlet,
all the files inside this module folder that are to be filtered will have the value of the variable ${artifactId} replaced by portlet-domainwhereas
the ${rootArtifactId} variable will be replaced by portlet
${package} The user provided package for the project, also prompted by maven when the user runs the archetype
${packageInPathFormat} The same value as ${package} variable but replacing '.' with the character'/',
e.g:, for the package com.foo.bar this variable is com/foo/bar
${groupId} The user supplied groupId for the project, prompted by maven when the user runs the archetype
${version} The user supplied version for the project, prompted by maven when the user runs the archetype
 
The archetype-metadata.xml stored in the archetype-resources/META-INF/maven
folder after the project is created, is where you need to tweak what you want generated and how.
  • id – This is the name of the module that will be generated.
  • dir – the template dir
  • name – the artifact Id that will be put in the pom file.

版权声明:本文为博主原创文章,未经博主允许不得转载。

Maven Archetype的更多相关文章

  1. maven archetype二三事

    maven plugin 创建maven archetype 骨架的plugin是 <plugin> <groupId>org.apache.maven.plugins< ...

  2. maven archetype生成自定义项目原型(模板)

    maven archetype可以将一个项目做成项目原型,之后只需要以此原型来创建项目,那么初始创建的项目便具有原型项目中的一切配置和代码.通俗讲就是一个项目模板. eclipse中那些快速生成mav ...

  3. Maven-003-私人定制 maven archetype

    在使用 Maven 创建项目模块的时候,依据其默认的 archetype 模板,创建出的目录.及默认的单元测试工具为 JUnit 3.8.1,而且有些常用的资源文件目录.配置文件(例如:Log4J 的 ...

  4. 自定义Maven Archetype模板

    1. 目的 自定义Maven Archetype模板目的为了把自己辛苦搭建的基础项目可以作为模板, 方便以后可以快速的创建类似项目,免去每次搭建的麻烦 2.把基础项目打包生成archetype项目 在 ...

  5. Maven Archetype简介以及搭建

    为什么会写这篇文章,因为公司先在构建项目骨架都是用的 maven archetype ,身为一个上进的渣渣猿,自己还是有必要了解下这个东西的. Archetype介绍 Archetype 是一个 Ma ...

  6. 创建并使用maven archetype的随笔

    maven骨架archetype的意义在于一些项目的基础项:如引入的maven组件,例如eureka,ribben等,不希望每次新建项目都重复做一遍,还有例如公司规范的log格式,单元测试工具等,在新 ...

  7. Jersey 2.x 从Maven Archetype 创建一个新项目

    创建 Jersey 工程需要使用 Apache 的 Maven 软件工程和管理工具.所有的Jersey产品模块都可以在 Maven中央库 中找到.这样的话 Jersey 可以非常容易和其他基于 Mav ...

  8. Jersey入门一:从Maven Archetype创建jersey项目

    1.用Ctrl+空格调出Spotlight搜索,输入ter调出终端窗口  2.在终端窗口进入将创建jersey项目的目录:  3.输入如下命令,创建一个名为的simple-service项目: m ...

  9. 使用Maven Archetype创建Java项目模板

    1.over view 简而言之,Archetype是一个Maven项目模板工具包.原型被定义为一种原始的模式或模型,所有其他同类的东西都是从中产生的.当我们试图提供一个提供生成Maven项目的一致方 ...

  10. 老大说新项目的结构和 xxx 项目一样就可以了,我 ……(使用 Maven Archetype 快速创建项目)

    前言 又要开发新项目了,还是创建新项目,怎么办?老大说按照 xxx 项目的结构创建一个新项目就可以了. 公众号:liuzhihangs,记录工作学习中的技术.开发及源码笔记:时不时分享一些生活中的见闻 ...

随机推荐

  1. 常用SQL Server日期格式化

    Select CONVERT(varchar(100), GETDATE(), 8): 10:57:46 Select CONVERT(varchar(100), GETDATE(), 24): 10 ...

  2. [手机取证] Jonathan Zdziarski公开的苹果iOS后门及POC视频

    Jonathan Zdziarski 近日在其推特上公布了此“后门”的研究及POC视频,并表示全球媒体“夸大”了此事,自己“从未表示过认为此后门与NSA的监控行为有关”. 视频 http://pan. ...

  3. ./upload/forum.php

    这是forum.php的全部代码,然后试着读一读,自己做做笔记. define('APPTYPEID', 2); define('CURSCRIPT', 'forum'); define(); 定义常 ...

  4. ubuntu14.04计划任务无法执行

    在/etc/crontab中添加了任务1,并确认执行时间设置没有错.发现任务没有执行,而/var/log/cron.log日志文件中没有该计划任务的执行信息.另一个计划任务却能正确,通过修改任务1的执 ...

  5. 利用SQL注入漏洞登录后台的实现方法

    利用SQL注入漏洞登录后台的实现方法 作者: 字体:[增加 减小] 类型:转载 时间:2012-01-12我要评论 工作需要,得好好补习下关于WEB安全方面的相关知识,故撰此文,权当总结,别无它意.读 ...

  6. iOS学习系列-Apache服务器的配置

    配置Apache服务器 一.目的 能够有一个测试的服务器,不是所有的特殊网络服务都能找到免费得! 二.为什么我们要用"Apache"? Apache是目前使用最广的web服务器 M ...

  7. Win7下安装Centos7

    win7下安装Centos同一块硬盘时:win启动项没有,使用pe进行修复,之后用easybcd进行centos启动项修复,grub2,自动搜索两块硬盘时:不要动启动项,bios选启动的硬盘即可 li ...

  8. Apache RewriteHTTPToHTTPS

    HTTP to HTTPS Scenario : You want to force people coming to your site to use HTTPS. Either for the e ...

  9. IntelliJ IDEA常用设置及快捷键

    IntelliJ IDEA是一款非常优秀的JAVA编辑器,初学都可会对其中的一些做法感到很别扭,刚开始用的时候我也感到很不习惯,在参考了网上一些文章后在这里把我的一些经验写出来,希望初学者能快速适应它 ...

  10. 《算法导论》 调用RANDOM(0,1),实现RANDOM(a,b)的过程

    描述RANDOM(a,b)的过程的一种实现,它只调用RANDOM(0,1).作为a和b的函数,你的程序的期望运行时间是多少?(RANDOM(0,1)以等概率输出0或者1,RANDOM(a,b)以等概率 ...