What is an archetype in Maven?

By | October 27, 2020

In this post, We will talk and learn about What is an archetype in Maven? 

  • An archetype is nothing but the template provided by the maven to create a project.
  • There is a huge number of maven archetypes listed out in order to create projects under different frameworks like spring, spring boot, hibernate, struts, web services (RESTful/SOAP), and many others.
  • We can create the Workspace directory wherever we want on our PC or use the Workspace if already created. Then type the below maven command (it’s a single line command) and press enter.

Above maven command will create a Java project with the following details:

  • groupId will be com.kkjavatutorials.samples, representing the package.
  • artifactId will be JavaSampleProject (on the build, JavaSampleProject.jar will be created)
  • archetypeArtifactId is the template used for creating this Java project.
  • interactiveMode is used when the developer is very well aware of the actual spelling of the artifact id. In our case, maven-archetype-quickstart is the correct one. If the software developer is not well aware of the artifact id correct spelling then the interactiveMode is set to be TRUE so that it will scan the remote repositories for all available archetypes. This might take a longer time.

The table below describes the main directories that are created as a part of the project.

Directory Description
JavaSampleProject The root folder of the project containing source and pom.xml
src\main\java Contains all the java code under the package com.kkjavatutorials.samples
src\main\test Contains all the java test code under the package com.kkjavatutorials.samples
src\main\resources Contains all the resources like xml\properties file etc..

That’s all about What is an archetype in Maven?

You May Also Like:

What is Maven?
How to install and setup Maven Environment on windows?
Create a maven project using the command line
How to import the maven project in Eclipse?
How to Create a New Maven Project in Eclipse
How to create a maven web application project in Eclipse
How to create a multi-module project using maven?
How to Fix missing src/main/java & src/test/java folders in the Eclipse Maven web Project?
How to create user-defined properties in Maven?
What is the maven local repository location & how to change it?
How to add or update the maven settings.xml file in eclipse?
Importing maven remote Archetype Catalogs in eclipse ?
What is POM in the maven Project?
What is Super POM in Maven Project?
Understanding the purpose of Maven Plugin
Compiling the Maven project with different JDK versions? 
Understanding of settings.xml in maven
How to enable a proxy setting in Maven?
Maven Dependency Scopes
How to generate javadoc in the maven Project
How to create a runnable JAR file with Maven?
How to add local jar files to a Maven project?
How to convert an existing Java Project to Maven in Eclipse?
How to exclude dependency in maven?
Managing External Dependencies in maven
Understanding of Maven Repositories
Snapshot Vs Version in maven
Apache Maven – Profiles

If you have any feedback or suggestion please feel free to drop in below comment box.

Leave a Reply

Your email address will not be published.