EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

Maven Quickstart Archetype

Secondary Sidebar
Maven Tutorial
  • Maven Basic and advance
    • What is Maven
    • How to Install Maven
    • Maven Commands
    • Maven GroupId
    • Maven WAR Plugin
    • Maven Build Command
    • Maven Failsafe Plugin
    • Maven Profile
    • IntelliJ Maven
    • Maven Enforcer Plugin
    • Maven Javadoc Plugin
    • Maven WAR Plugin
    • Maven Build Command
    • Maven GroupId
    • Maven Force Update
    • Maven Encrypt Password
    • Maven Environment Variables
    • AssertJ Maven
    • Maven Run Single Test
    • Maven kafka-clients
    • Maven Quickstart Archetype
    • Maven Install Dependencies
    • Maven XMLBeans
    • Maven Local Repository
    • Maven Versions
    • Maven Jar Plugin
    • Maven Assembly Plugin
    • Maven exec plugin
    • Maven Central Repository
    • Maven Surefire
    • Maven Deploy
    • Maven Phases
    • Maven Archetype
    • Maven Skip Test
    • Maven Dependency Scope
    • Maven Shade Plugin
    • Maven Repository Spring
    • Maven Eclipse Plugin
    • Maven Exclude Dependency
    • Maven Life Cycle
    • Maven Repository
    • Maven POM File
    • Maven Plugins
    • What is Maven Plugins
    • Maven Interview Questions
    • Maven Flags
    • Maven Project
    • Maven Settings.XML
Home Software Development Software Development Tutorials Maven Tutorial Maven Quickstart Archetype

Maven Quickstart Archetype

Introduction to Maven Quickstart Archetype

Maven quickstart archetype is used to generate the maven sample project, by using the archetype we can create a new project. The maven quickstart archetype is nothing but a plugin whose work is to create the structure of the project as per the template which we have defined. We are using the maven quickstart archetype to create a simple java application. For creating the project by using the maven quickstart archetype we need to execute the mvn command.

Key Takeaways

  • The maven archetype is nothing but a kind of project abstraction which was instantiated from the customized project of the maven.
  • It is nothing but a template project from which we are creating another project. The main use of archetype in maven is we can standardize the development of the project.

What is Maven Quickstart Archetype?

Suppose we need to create a sample project by using the command line same time, we are using the maven quickstart archetype. While creating the project we need to pass the archetype generate parameter with the mvn command, it will create a new maven project. There are multiple types of archetypes available in maven for creating the project. For starting a new project, we need to use the maven archetype plugin from the command line. The archetype generates goal will select the default archetype which is suggested after pressing the enter key. Maven archetype plugin will be creating a directory name as simple which matches the artifactid.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

All in One Software Development Bundle(600+ Courses, 50+ projects)
Python TutorialC SharpJavaJavaScript
C Plus PlusSoftware TestingSQLKali Linux
Price
View Courses
600+ Online Courses | 50+ projects | 3000+ Hours | Verifiable Certificates | Lifetime Access
4.6 (86,064 ratings)

How to Create Archetype?

For creating the archetype project first we need to create a console where we have installed mvn.

Below steps shows how we can create the archetype as follows:

1. In the first step we are opening the console where our mvn is installed. In the below example we have configured the maven command, so we have no need to find the specified maven path.

Maven Quickstart Archetype 1

2. After opening the command shell now, we are executing the below command for creating the archetype project as follows. We are using the mvn command with archetype generate parameter as follows.

Command:

mvn archetype:generate

Output:

Maven Quickstart Archetype 2

3. After executing the mvn archetype command, in this step we are choosing the default to apply filter. We are not entering anything so it will choose as default.

Maven Quickstart Archetype 3

4. After defining the default option of archetype quickstart, now in this step we are choosing the version of archetype quickstart. In the below example, we can see that it will display the eighth version. While pressing enter it will be choosing the default version as 8.

Eighth version

5. After defining the version of the archetype in this step we are entering the details of the project. We are entering below the details of the project. We need to define the value of groupid, artifactid, version, and package as follows.

groupId – com.archetype
version – 1.0-SNAPSHOT
artifactId – maven_archetype
package – maven_archetype

Maven Quickstart Archetype 5

6. After entering the details now in this step we are confirming all the details which we have entered as follows.

 confirming the details

7. After entering all the details, after going into the project we can see that the maven_archetype project is created and all the files are created.

Maven Quickstart Archetype 7

8. After checking the structure of the project in the below example we can see that the pom.xml file is also generated in the project directory.

Maven Quickstart Archetype 8

Maven Quickstart Archetype 9

9. After checking the pom.xml file in the below example we can see that the App.java file is created into the project folder as follows.

App.java file is created into project folder

10. After checking the App.java file in the below example we can see that the AppTest.java file is created into the project folder as follows.

Project folder

Using Archetype Project

The maven archetype plugin will be allowing us for users to create the maven project by using the archetype and generate goal. In the below example, we are creating the maven project by defining all the project values as follows. The below command will generate the maven project from our archetype as follows.

Command:

mvn archetype:generate –DarchetypeGroupId = com.archetype –DarchetypeArtifactId = archetype –DarchetypeVersion = 1.0-SNAPSHOT –DgroupId = com.archetype –DartifactId = archetype_sample –Dversion = 1.0-SNAPSHOT

Output:

Maven Quickstart Archetype 12

We need to pass the archetype arguments with the maven archetype plugin for generating the archetype goal. We can also pass the project which was the archetype from which we are providing the archetype interactive mode. The maven archetype project is generated we can invoke the same by running the below command.

Code:

mvn package liberty:run

Output:

interactive mode

After generating the archetype project in the below example we are checking the pom.xml file of the project as follows.

pom.xml file of project

Maven Quickstart Different Archetypes

There are multiple types of archetypes available in maven which are mentioned below.

  • maven-archetype-archetype – This archetype contains the archetype which contains a sample project.
  • maven-archetype-j2ee-simple – This archetype will contain the sample simplified application of J2EE.
  • maven-archetype-mojo – This archetype will contain the maven plugin which is a sample in nature.
  • maven-archetype-plugin-site – This archetype will contain the sample maven site of the plugin.
  • maven-archetype-plugin – This archetype will contain the sample maven plugin which is used in the maven archetype project.
  • maven-archetype-portlet – This archetype will contain the sample portlet of JSR 268.
  • maven-archetype-quickstart – This archetype will contain the sample maven project which is developed using maven.
  • maven-archetype-simple – This archetype will contain the simple maven project which is developed using maven.
  • maven-archetype-site-sample – This archetype will contain the sample maven site.
  • maven-archetype-webapp – This archetype will contain the sample maven webapps project.
  • maven-archetype-site – This archetype will contain the sample maven site which was demonstrating the supporting documents like APT, FML, and XDOC which were demonstrated on our site.

Examples of Maven Quickstart Archetype

Given below are the examples mentioned:

Example #1

The below example shows the maven quickstart archetype as follows. We are using a simple generate parameter for creating the project by using maven quickstart. We are entering below details of the project, we are defining the value of groupid, artifactid, version, and package as follows.

mvn archetype:generate
groupId – com.maven
version – 1.0-SNAPSHOT
artifactId – archetype
package – archetype

Maven Quickstart Archetype 15

Maven Quickstart Archetype 16

Example #2

In the below example, we are defining all the parameters as the time of executing the maven generate command as follows.

Command:

mvn archetype:generate –DarchetypeGroupId = com.maven –DarchetypeArtifactId = maven –DarchetypeVersion = 1.0-SNAPSHOT –DgroupId = com.maven –DartifactId = maven_sample –Dversion = 1.0-SNAPSHOT

Output:

Maven Quickstart Archetype 17

FAQ

Given below are the FAQs mentioned:

Q1. What is the use of maven quickstart archetype?

Answer: Basically, maven quickstart archetype is used to create the maven project. It will create all the structure of the maven project. We can develop a sample application by using archetypes.

Q2. Which plugin do we need to use while creating a project using the maven archetype?

Answer: We need to use the archetype plugin while developing the application by using maven archetype quickstart.

Q3. What is the use of the maven archetype descriptor while creating the project?

Answer: The descriptor of the maven archetype is the heart of the archetype project. It is an xml file name archetype-metadata.xml located in the project directory.

Conclusion

Archetype generates a goal that selects the default archetype which is suggested after pressing the enter key. Maven archetype plugin will be creating a directory name as simple which matches the artifactid. Maven quickstart archetype is nothing but a plugin whose work is to create the structure of the project as per the template, we have defined.

Recommended Articles

This is a guide to Maven Quickstart Archetype. Here we discuss the introduction, how to create Archetype? and maven quickstart different archetypes and examples. You may also have a look at the following articles to learn more –

  1. Maven Build Command
  2. Maven WAR Plugin
  3. Maven Profile
  4. Maven Versions

 

Popular Course in this category
Maven Training (4 Courses, 6 Projects)
  4 Online Courses |  6 Hands-on Project |  26+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Software Development Course

C# Programming, Conditional Constructs, Loops, Arrays, OOPS Concept

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Special Offer - Maven Training (4 Courses, 6 Projects) Learn More