版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。

新建Maven project项目时,需要选择archetype。

那么,什么是archetype?

archetype的意思就是模板原型的意思,原型是一个Maven项目模板工具包。一个原型被定义为从其中相同类型的所有其它事情是由一个原始图案或模型。名称配合,因为我们正在努力提供一种系统,该系统提供了一种生成Maven项目的一致的手段。原型将帮助作者为用户创建Maven项目模板,并为用户提供了手段,产生的这些项目模板参数化的版本。

建立Maven项目时,网上建议的分别是

1、cocoon-22-archetype-webapp

2、maven-archetype-quickstart

3、maven-archetype-webapp

那么为什么是这三种模板呢?这三种模板分别代表什么意思呢?

1、cocoon-22-archetype-webapp

建好项目后,项目的结构如下:

可以看到,这个项目结构里包含了applicationContext.xml、log4j.xml、web.xml

pom.xml的内容如下:


  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  17. -->
  18. <!-- $Id: pom.xml 642118 2008-03-28 08:04:16Z reinhard $ -->
  19. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  20. <modelVersion>4.0.0</modelVersion>
  21. <packaging>war</packaging>
  22. <name>springboot-cocoon</name>
  23. <groupId>com.study.cx</groupId>
  24. <artifactId>springboot-cocoon</artifactId>
  25. <version>0.0.1-SNAPSHOT</version>
  26. <build>
  27. <plugins>
  28. <plugin>
  29. <groupId>org.mortbay.jetty</groupId>
  30. <artifactId>maven-jetty-plugin</artifactId>
  31. <version>6.1.7</version>
  32. <configuration>
  33. <connectors>
  34. <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
  35. <port>8888</port>
  36. <maxIdleTime>30000</maxIdleTime>
  37. </connector>
  38. </connectors>
  39. <webAppSourceDirectory>${project.build.directory}/${pom.artifactId}-${pom.version}</webAppSourceDirectory>
  40. <contextPath>/</contextPath>
  41. </configuration>
  42. </plugin>
  43. </plugins>
  44. </build>
  45. <dependencies>
  46. <!--dependency>
  47. <groupId>com.study.cx</groupId>
  48. <artifactId>[the artifact id of the block to be mounted]</artifactId>
  49. <version>0.0.1-SNAPSHOT</version>
  50. </dependency-->
  51. </dependencies>
  52. </project>

2、maven-archetype-quickstart

建好项目后,项目的结构如下:

在这个项目里,除了pom.xml外,没有其他的xml了,但是有main、test两个包,包里放了一个App、AppTest类

pom.xml的内容如下:


  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <groupId>com.study.cx</groupId>
  5. <artifactId>springboot-quickstart</artifactId>
  6. <version>0.0.1-SNAPSHOT</version>
  7. <packaging>jar</packaging>
  8. <name>springboot-quickstart</name>
  9. <url>http://maven.apache.org</url>
  10. <properties>
  11. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  12. </properties>
  13. <dependencies>
  14. <dependency>
  15. <groupId>junit</groupId>
  16. <artifactId>junit</artifactId>
  17. <version>3.8.1</version>
  18. <scope>test</scope>
  19. </dependency>
  20. </dependencies>
  21. </project>

3、maven-archetype-webapp

建好项目后,项目的结构如下:

在这个项目里,有WEB-INF目录,并且有web.xml和一个index.jsp

pom.xml的内容如下:


  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <groupId>com.study.cx</groupId>
  5. <artifactId>srpingboot-mavenWebapp</artifactId>
  6. <packaging>war</packaging>
  7. <version>0.0.1-SNAPSHOT</version>
  8. <name>srpingboot-mavenWebapp Maven Webapp</name>
  9. <url>http://maven.apache.org</url>
  10. <dependencies>
  11. <dependency>
  12. <groupId>junit</groupId>
  13. <artifactId>junit</artifactId>
  14. <version>3.8.1</version>
  15. <scope>test</scope>
  16. </dependency>
  17. </dependencies>
  18. <build>
  19. <finalName>srpingboot-mavenWebapp</finalName>
  20. </build>
  21. </project>

maven提供的41个骨架原型分别是:

1:
appfuse-basic-jsf (创建一个基于Hibernate,Spring和JSF的Web应用程序的原型) 
2: appfuse-basic-spring(创建一个基于Hibernate,Spring和Spring MVC的Web应用程序的原型) 
3: appfuse-basic-struts(创建一个基于Hibernate,Spring和Struts 2的Web应用程序的原型) 
4: appfuse-basic-tapestry(创建一个基于Hibernate,Spring
和 Tapestry 4的Web应用程序的原型) 
5: appfuse-core(创建一个基于Hibernate,Spring
和 XFire的jar应用程序的原型) 
6: appfuse-modular-jsf(创建一个基于Hibernate,Spring和JSF的模块化应用原型) 
7: appfuse-modular-spring(创建一个基于Hibernate, Spring 和 Spring MVC 的模块化应用原型) 
8: appfuse-modular-struts(创建一个基于Hibernate, Spring 和 Struts 2 的模块化应用原型) 
9: appfuse-modular-tapestry (创建一个基于 Hibernate, Spring 和 Tapestry 4 的模块化应用原型) 
10: maven-archetype-j2ee-simple(一个简单的J2EE的Java应用程序) 
11: maven-archetype-marmalade-mojo(一个Maven的 插件开发项目 using marmalade) 
12: maven-archetype-mojo(一个Maven的Java插件开发项目) 
13: maven-archetype-portlet(一个简单的portlet应用程序) 
14: maven-archetype-profiles() 
15:maven-archetype-quickstart() 
16: maven-archetype-site-simple(简单的网站生成项目) 
17: maven-archetype-site(更复杂的网站项目) 
18:maven-archetype-webapp(一个简单的Java
Web应用程序) 
19: jini-service-archetype(Archetype for Jini service project creation) 
20: softeu-archetype-seam(JSF+Facelets+Seam Archetype) 
21: softeu-archetype-seam-simple(JSF+Facelets+Seam (无残留) 原型) 
22: softeu-archetype-jsf(JSF+Facelets 原型) 
23: jpa-maven-archetype(JPA 应用程序) 
24: spring-osgi-bundle-archetype(Spring-OSGi 原型) 
25: confluence-plugin-archetype(Atlassian 聚合插件原型) 
26: jira-plugin-archetype(Atlassian JIRA 插件原型) 
27: maven-archetype-har(Hibernate 存档) 
28: maven-archetype-sar(JBoss 服务存档) 
29: wicket-archetype-quickstart(一个简单的Apache Wicket的项目) 
30: scala-archetype-simple(一个简单的scala的项目) 
31: lift-archetype-blank(一个 blank/empty liftweb 项目) 
32: lift-archetype-basic(基本(liftweb)项目) 
33: cocoon-22-archetype-block-plain([http://cocoapacorg2/maven-plugins/]) 
34: cocoon-22-archetype-block([http://cocoapacorg2/maven-plugins/]) 
35:cocoon-22-archetype-webapp([http://cocoapacorg2/maven-plugins/]) 
36: myfaces-archetype-helloworld(使用MyFaces的一个简单的原型) 
37: myfaces-archetype-helloworld-facelets(一个使用MyFaces和Facelets的简单原型) 
38: myfaces-archetype-trinidad(一个使用MyFaces和Trinidad的简单原型) 
39: myfaces-archetype-jsfcomponents(一种使用MyFaces创建定制JSF组件的简单的原型) 
40: gmaven-archetype-basic(Groovy的基本原型) 
41: gmaven-archetype-mojo(Groovy mojo 原型)

(41中骨架原文链接:http://www.cnblogs.com/iusmile/archive/2012/11/14/2770118.html)

Maven 三种archetype说明--转载的更多相关文章

  1. Maven 三种archetype说明

    新建Maven project项目时,需要选择archetype. 那么,什么是archetype? archetype的意思就是模板原型的意思,原型是一个Maven项目模板工具包.一个原型被定义为从 ...

  2. Maven三种仓库的配置

    转自:https://www.cnblogs.com/jack1995/p/6925879.html Maven三种仓库的配置 1 本地仓库的配置 在第一篇中我们介绍过,Maven的仓库有三类,这里不 ...

  3. 服务器文档下载zip格式 SQL Server SQL分页查询 C#过滤html标签 EF 延时加载与死锁 在JS方法中返回多个值的三种方法(转载) IEnumerable,ICollection,IList接口问题 不吹不擂,你想要的Python面试都在这里了【315+道题】 基于mvc三层架构和ajax技术实现最简单的文件上传 事件管理

    服务器文档下载zip格式   刚好这次项目中遇到了这个东西,就来弄一下,挺简单的,但是前台调用的时候弄错了,浪费了大半天的时间,本人也是菜鸟一枚.开始吧.(MVC的) @using Rattan.Co ...

  4. mybatis:三种参数传递(转载)

    转载自:https://www.2cto.com/database/201409/338155.html 第一种方案 DAO层的函数方法 Public User selectUser(String n ...

  5. PHP三种运行方式(转载)

    三种运行方式:mod_php5.cgi.fast-cgi 1. 通过HTTPServer内置的模块来实现, 例如Apache的mod_php5,类似的Apache内置的mod_perl可以对perl支 ...

  6. Oracle学习笔记—connect、resource和dba三种权限(转载)

    转载自: connect.resource和dba三种标准角色: 授权语句: grant connect ,resource,dba to user with admin option; (注意:其中 ...

  7. Linux mysql 修改密码 三种方式(转载)

    注明:本文为转载,原文地址:https://www.cnblogs.com/chuckjam/archive/2018/08/10/9456255.html 前言 有时我们会忘记Mysql的密码,或者 ...

  8. android解析XML总结(SAX、Pull、Dom三种方式) <转载>

    android解析XML总结(SAX.Pull.Dom三种方式) http://www.cnblogs.com/JerryWang1991/archive/2012/02/24/2365507.htm ...

  9. Stack的三种含义(转载--阮一峰)

    作者: 阮一峰 学习编程的时候,经常会看到stack这个词,它的中文名字叫做"栈". 理解这个概念,对于理解程序的运行至关重要.容易混淆的是,这个词其实有三种含义,适用于不同的场合 ...

随机推荐

  1. c#子线程执行完怎么通知主线程(转)

    定义一个委托实现回调函数 public delegate void CallBackDelegate(string message); 程序开始的时候 //把回调的方法给委托变量 CallBackDe ...

  2. laravel console handle 传参方法

    <?php namespace App\Console\Commands; use Illuminate\Console\Command; use App\Libs\wxpay\CLogFile ...

  3. Pyhthon3之使用__slots__

    正常情况下,我们定义了一个class,创建了一个class实例后,我们可以给该实例绑定任何属性和方法,这就是动态语言的灵活性.先定义class: >>> class Student( ...

  4. Andrew Ng机器学习课程11之使用machine learning的建议

    Andrew Ng机器学习课程11之使用machine learning的建议 声明:引用请注明出处http://blog.csdn.net/lg1259156776/ 2015-9-28 艺少

  5. Flarum 安装问题 编译安装 fileinfo.so

    大部分人上传 会遇到文件没有权限这一问题 ,这个好解决 下边是服务器 php.ini 扩展 fileinfo 由于php 版本是7.1.8 最新的 又是用的一键环境安装 所以 没有安装这个扩展 1.去 ...

  6. hupu面试

    1.mybatis更新一条数据时,如果某字段为空,则不更新它,使用默认值? <update id="updateProduct" parameterType="Pr ...

  7. 【转载】49个CSS知识点

    01.[负边距]

  8. windows和linux环境下使用google的glog日志库

    一.概述 glog是google推出的一款轻量级c++开源日志框架,源码在github上,目前最新release版本是v0.3.5. githut地址:https://github.com/googl ...

  9. PHP二维数组的引用赋值容易犯的错误

    大家一起来分析一下下面这段代码: <?php $arr = array(); $arr["abc"] = array("sex" => 100, & ...

  10. 新浪sae对storage的文档进行读写操作

    有的人喜欢将一些数据写在服务器的文件里面,并不喜欢存在mysql里,但新浪sae却不支持对本地文件进行操作. 不过sae拓展了一个storage的服务,可以将一些静态文件放在上面.本文不介绍文件的上传 ...