When you create a new MAVEN project item, you need to select archetype.
So, what is archetype.
Archetype means that the template prototype is meant to be a MAVEN project template toolkit. A prototype is defined from which all other things of the same type are made up of an original pattern or model. Name fits because we are working to provide a system that provides a consistent means of generating MAVEN projects. Prototypes will help authors create MAVEN project templates for users and provide users with the means to produce parameterized versions of these project templates.
when creating a Maven project, the advice on the web is
1, Cocoon-22-archetype-webapp
2, Maven-archetype-quickstart
3, Maven-archetype-webapp
So why are these three types of templates? What is the meaning of these three templates respectively?
1, Cocoon-22-archetype-webapp
After the project is built, the structure of the project is as follows:
As you can see, this project structure contains Applicationcontext.xml, Log4j.xml, Web.xml
The contents of Pom.xml are as follows:
<?xml version= "1.0" encoding= "UTF-8"?> <!--licensed to the Apache Software Foundation (ASF) under one or mor E Contributor license agreements. The NOTICE file distributed with this work for additional information regarding copyright. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); You are not to use this file except in compliance with the License. You could obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable LA W or agreed to in writing, software distributed under the License was distributed on ' as is ' basis, without warranti ES OR CONDITIONS of any KIND, either express or implied.
The License for the specific language governing permissions and limitations under the License. --> <!--$Id: Pom.xml 642118 2008-03-28 08:04:16z Reinhard $--> <project "xmlns= 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 " > <modelVersion>4.0.0</modelVersion> <packaging>war</packaging> <name>maven-demo </name> <groupId>com.dongguo</groupId> <artifactId>maven-demo</artifactId> < version>1.0-snapshot</version> <build> <plugins> <plugin> <groupid>o Rg.mortbay.jetty</groupid> <artifactId>maven-jetty-plugin</artifactId> <version>6. 1.7</version> <configuration> <connectors> <connector implementation= "O Rg.mortbay.jetty.nio.SelectChannelConnector "> <port>8888</port> <maxidletime >30000</maxIdleTime> </connector> </connectors> <webappsourcedirec Tory>${project.build.directory}/${pom.aRtifactid}-${pom.version}</webappsourcedirectory> <contextPath>/</contextPath> </co nfiguration> </plugin> </plugins> </build> <dependencies> <!--dependency&
Gt <groupId>com.dongguo</groupId> <artifactid>[the Artifact ID of the "block" to be Mounted]</artifa ctid> <version>1.0-SNAPSHOT</version> </dependency--> </dependencies> </project
>
2, Maven-archetype-quickstart
After the project is built, the structure of the project is as follows:
in this project, there is no more XML than Pom.xml, but there are main, Test two packages with an app, Apptest class
Pom.xml the contents of the following:
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:s chemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelversion >4.0.0</modelVersion> <groupId>com.dongguo</groupId> <artifactid>maven-demo</ Artifactid> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <!--TODO Project name--> <name>quickstart</name> <description></description> <!--TOD
O <organization> <name>company name</name> <url>company url</url> </organization>--> <licenses> <license> <name>the Apache so
Ftware License, Version 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <distribution>repo</distribution> </license> </licenses> <dependencies> <!--WICKET Depe Ndencies--> <dependency> <groupId>org.apache.wicket</groupId> <a Rtifactid>wicket</artifactid> <version>${wicket.version}</version> </dependenc y> <!--OPTIONAL <dependency> <groupid>org.apache.wicket</groupid>
;
<artifactId>wicket-extensions</artifactId> <version>${wicket.version}</version>
</dependency>--> <!--LOGGING dependencies-log4j--> <dependency>
<groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.4.2</version> </dependency> <dependency> <groupid& Gt;log4j&lT;/groupid> <artifactId>log4j</artifactId> <version>1.2.14</version>
</dependency> <!--JUNIT dependency for testing--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <v Ersion>3.8.2</version> <scope>test</scope> </dependency> ;! --JETTY dependencies for testing--> <dependency> <groupid>org.mortbay.jetty</gr Oupid> <artifactId>jetty</artifactId> <VERSION>${JETTY.VERSION}</VERSION&G
T <scope>provided</scope> </dependency> <dependency> <groupid>org. Mortbay.jetty</groupid> <artifactId>jetty-util</artifactId> <version>${jet Ty.version}</version> <scope>provided</scope> </dependency> <dependency>
;
<groupId>org.mortbay.jetty</groupId> <artifactId>jetty-management</artifactId> <version>${jetty.version}</version> <scope>provided</scope> </dependen
cy> </dependencies> <build> <resources> <resource>
<filtering>false</filtering> <directory>src/main/resources</directory>
</resource> <resource> <filtering>false</filtering> <directory>src/main/java</directory> <includes> <include>**< ;/include> </includes> <excludes> <EXCLUDE>**/*.J Ava</exclude> </excludes> </resource> </resources> <testresou rces> <testResource> <filtering>false</filtering> <dir Ectory>src/test/java</directory> <includes> <INCLUDE>**</INCLU de> </includes> <excludes> <exclude>**/*.java< /exclude> </excludes> </testResource> </testResources> &L
T;plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> </plugin> </plugins> </buil D> <properties> <wicket.version>1.3.2</wicket.version> <jetty.version>6.1.
4</jetty.version> </properties> </project>
3, Maven-archetype-webapp
After the project is built, the structure of the project is as follows:
In this project, there is a web-inf directory, and there are web.xml and a index.jsp
The contents of Pom.xml are as follows:
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:s chemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelversion >4.0.0</modelVersion> <groupId>com.dongguo</groupId> <artifactid>maven-demo</ artifactid> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name> Maven-demo Maven webapp</name> <url>http://maven.apache.org</url> <dependencies> &
Lt;dependency> <groupId>junit</groupId> <artifactId>junit</artifactId>
<version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>maven-demo</finalName> </build> </p
Roject>
The 41 skeleton prototypes provided by Maven are:
1:APPFUSE-BASIC-JSF (Create a prototype of a Web application based on hibernate,spring and JSF)
2:appfuse-basic-spring (Creating a prototype for a Web application based on hibernate,spring and spring MVC)
3:appfuse-basic-struts (Create a prototype of a Web application based on hibernate,spring and Struts 2)
4:appfuse-basic-tapestry (Create a prototype of a Web application based on hibernate,spring and Tapestry 4)
5:appfuse-core (Create a prototype based on the hibernate,spring and Xfire jar applications)
6:APPFUSE-MODULAR-JSF (Creating a modular application prototype based on Hibernate,spring and JSF)
7:appfuse-modular-spring (Create a modular application prototype based on Hibernate, Spring, and spring MVC)
8:appfuse-modular-struts (Create a modular application prototype based on Hibernate, Spring, and Struts 2)
9:appfuse-modular-tapestry (Create a modular application prototype based on Hibernate, Spring, and Tapestry 4)
10:maven-archetype-j2ee-simple (A simple Java EE application)
11:maven-archetype-marmalade-mojo (a MAVEN plug-in development project using marmalade)
12:maven-archetype-mojo (a MAVEN Java Plug-in development project)
13:maven-archetype-portlet (a simple portlet application)
14:maven-archetype-profiles ()
15:maven-archetype-quickstart ()
16:maven-archetype-site-simple (simple Web site Generation project)
17:maven-archetype-site (more complex web site projects)
18:maven-archetype-webapp (A simple Java Web application)
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 (no residue) prototype)
22:SOFTEU-ARCHETYPE-JSF (Jsf+facelets prototype)
23:jpa-maven-archetype (JPA application)
24:spring-osgi-bundle-archetype (SPRING-OSGI prototype)
25:confluence-plugin-archetype (Atlassian aggregation plug-in prototype)
26:jira-plugin-archetype (Atlassian Jira plug-in prototype)
27:maven-archetype-har (Hibernate archive)
28:maven-archetype-sar (JBoss service archive)
29:wicket-archetype-quickstart (a simple Apache wicket project)
30:scala-archetype-simple (a simple Scala project)
31:lift-archetype-blank (a blank/empty liftweb project)
32:lift-archetype-basic (Basic (Liftweb) project)
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 (using a simple prototype of the myfaces)
37:myfaces-archetype-helloworld-facelets (a simple prototype using myfaces and Facelets)
38:myfaces-archetype-trinidad (a simple prototype using myfaces and Trinidad)
39:myfaces-archetype-jsfcomponents (a simple prototype that uses Myfaces to create custom JSF components)
40:gmaven-archetype-basic (the basic prototype of groovy)
41:gmaven-archetype-mojo (Groovy Mojo prototype)