EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login
Home Software Development Software Development Tutorials Spring Tutorial Spring Boot Maven
Secondary Sidebar
Spring Tutorial
  • Spring Boot
    • What is Spring Boot
    • Spring Boot flyway
    • Spring Boot framework
    • Spring Boot Logback
    • Spring Boot actuator endpoints
    • Spring Boot gRPC
    • Spring Boot jdbctemplate example
    • Spring Boot ehcache
    • Spring Boot Architecture
    • Spring Boot Port
    • Introduction of spring boot
    • Spring Boot ide
    • Spring Boot Netty
    • Spring Boot ORM
    • Spring Boot Versions
    • Spring Boot JUnit
    • Spring Boot Keycloak
    • Spring Boot gradle
    • Spring Boot Lombok
    • Spring Boot autowired
    • Spring Boot bean
    • Spring Boot hibernate
    • Spring Boot integration test
    • Spring Boot jdbc
    • Spring Boot MongoDB
    • Spring Boot postgresql
    • Spring Boot rest
    • Spring Boot swagger
    • Spring Boot thymeleaf
    • Spring Boot Unit Test
    • Spring Boot Webflux
    • Spring Boot webclient
    • Spring Boot kubernetes
    • Spring Boot Properties
    • Spring Boot Validation
    • Spring Boot Feature
    • Spring Boot Application
    • Spring Boot email
    • Spring Boot MVC
    • Spring Boot Exception Handling
    • Spring Boot Starter Parent
    • Spring Boot Docker
    • Spring Boot Logging
    • Spring Boot Query
    • Spring Boot Multiple Data Sources
    • Spring Boot Basic Authentication
    • Spring Boot Test
    • Spring Boot jwt
    • Spring Boot Liquibase
    • Spring Boot Prometheus
    • Spring Boot debug
    • Spring Boot GraalVM
    • Spring Boot Batch
    • Spring Boot controller
    • Spring Boot CLI
    • Spring Boot file upload
    • Spring Boot interceptor
    • Spring Boot Service
    • Spring Boot Configuration
    • Spring Boot Datasource Configuration
    • Spring Boot Annotations
    • Spring Boot Starter We
    • Spring Boot Actuator
    • Spring Boot DevTools
    • Spring Boot Repository
    • Spring Boot Dependencies
    • Spring Boot Path Variable
    • Spring Boot Microservices
    • Spring Boot Run Command
    • Spring Boot application.properties
    • Spring Boot Transaction Management
    • Spring Boot Banner
    • Spring Boot JPA
    • Spring Boot Change Port
    • Spring Boot RestTemplate
    • Spring Boot cors
    • Spring Boot HTTPS
    • Spring Boot OAuth2
    • Spring Boot Profiles
    • Spring Boot Interview Questions
    • Spring Boot filter
    • Spring boot logging level
    • Spring Boot Cache
    • Spring Boot Advantages
    • Spring Boot Scheduler
    • Spring Boot Initializr
    • Spring Boot Maven
    • Spring Boot Admin
    • Spring Boot Tomcat
    • Spring Boot WebSocket
    • Spring Boot Executable Jar
    • Spring Boot CommandLineRunner
    • Spring Boot DataSource
    • Spring Batch Scheduler
    • Spring Batch Example
    • Spring Batch Tasklet
    • Spring Batch Admin
    • Spring Batch
    • Spring Boot Qualifier
    • Spring Boot War
    • Spring Boot Test Configuration
  • Spring
    • What is Spring Framework?
    • Spring Architecture
    • What is Spring Integration?
    • IoC Containers
    • What is AOP?
    • Spring Modules
    • Spring Batch Processing
    • Spring Batch Partitioner
    • Spring Batch Job
    • Spring AOP
    • Spring Expression Language
    • Dependency Injection in Spring
    • Spring Batch Architecture
    • Spring framework Interview Questions
  • Spring Cloud Basics
    • What is Spring Cloud
    • Spring Cloud Contract
    • Spring Cloud Components
    • Spring Cloud Version
    • Spring Cloud Data Flow
    • Spring cloud stream
    • Spring Cloud Dependencies
    • Spring cloud microservices
    • spring cloud gateway
    • Spring Cloud Config
    • Spring Cloud Kubernetes
    • Spring Cloud Sleuth

Spring Boot Maven

Spring Boot Maven

Introduction to Spring Boot Maven

Spring boot maven will provide the support in maven of apache, it allows us to package the executable JAR or archives of WAR. It manages the dependency of the project automatically, we have no need to download the dependency of the project while developing the maven project. Using spring boot maven project we can run our application locally, also we can build the project EAR, JAR or WAR file. We can create a new maven project using the spring tool suite or we can also create using eclipse, STS is a very useful tool used for maven project development.

What is Spring Boot Maven?

We do not have to manually download and add the project dependency, it will automatically add the same into project. It will automatically add the dependency of the project in pom.xml file. It has important features which were used to manage the transitive dependencies. We can also run projects using a command-line interface or we can also use IDE tools like spring tool suite (STS) or eclipse to run the maven project.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Using it we have no need to first build the project at the time of deployment it will automatically deployed. It uses the project object module (POM) file. This is the configuration file used in the project. This file contains the project dependency, source and build directories and also contains the other details of the project. Pom.xml file contains the following minimal requirements. We need to use the following tags at the time of adding any plugin or dependency related to the project.

Pom.xml file requirement of minimal configuration:

  • Project: The pom.xml file start with the project section. This is the root tag of our project.
  • Model version: As per the maven version we need to set the model version in pom.xml file. If suppose we are using a maven version like 2 or 3 then we need to set the model version as 4.0.0
  • Groupid: This is the name of the organization which was using for our project. This is nothing but the groupid of our project.
  • Artifactid: This is a very important tag while developing an application with the project. This is the unique name of our application.
  • Version: This is nothing but the project version.

We need also add another tags like dependencies, this tag is related to the dependency related to our project. We can search specific projects, groupid, artifactid, version and model versions using mvnrepository.com.

Getting Started Spring Boot Maven

Spring boot maven is used to create stand alone and web based applications. Using the project we have required less configuration of our project.

We require the following software to develop the project.

Spring Boot Maven 1

Spring boot 2.5.4 and maven requires the java version as 8.

It will support the following servlet containers as follows:

Spring Boot Maven 2

We can also build our spring boot maven project using the servlet container version is greater than 3.1. We can use it with java development tools like an eclipse of spring tool suite. Spring boot is compatible with maven 3.3 and the above version we cannot use less version to use maven with spring boot. We need to install a maven to develop the project using it.

We can check the maven version by using the following command on the Linux system.

Code:

# mvn –v

Also, we can check the installed java version by using the following command on the Linux system.

Code:

# java –version

To create the application, we first need to create pom.xml file. Pom.xml file is very important while developing a project. It is providing the starter which was used to add the jar in our classpath. To end our project we need to create only one java file, spring boot maven will compile source from main java file by default.

Examples of Spring Boot Maven

We can create the project as follows:

Example #1

Create project using spring tool suite.

  • Below example shows that creates project using the spring tool suite as follows.
  • Below is the step by step procedure to create a new project as follows.
  • To create a new project first go on the File menu in the File menu select the new project. After selecting the project menu select maven project.

File -> project -> maven project.

Output:

Spring Boot Maven 3

  • After selecting the maven project select the workspace location of the project. We are selecting the default workspace location of our project.

select the workspace location of project

  • After selecting the workspace we need to select the archetype of our project as below.

we need to select archetype

  • After selecting the archetype we need to specify the tags of the archetype as follows.

Groupid: springboot
Artifactid: springbootmaven
Package: springboot.springbootmaven

Output:

archetype we need to specify the tags

  • After selecting all the parameters enter on the finish to view the created project.

enter on finish to view

Example #2

Create spring boot maven project using spring.io.

  • Below example shows that create project using spring.io as follows.
  • To create project using spring.io go to a specified site then enter the details related to project.

Artifact: springboot
Name: springboot
Java version: 11

Output:

Spring Boot Maven 8

  • After filling in all the details click on to generate it will create a new project. After downloading extract the files. After extracting open the project using the import project option.

Spring Boot Maven 9

  • Then select the root directory of project.

Spring Boot Maven 10

  • After selecting the root directory click on finish it will create a new project.

Spring Boot Maven 11

Conclusion

Spring boot maven is nothing but the tool which was used to automate the build process of the project. Using project we can run our application locally, also we can build the project EAR, JAR or WAR file. STS is a very useful tool used for project development.

Recommended Articles

This is a guide to Spring Boot Maven. Here we discuss the introduction, getting started spring boot maven and examples respectively. You may also have a look at the following articles to learn more –

  1. Maven Repository Spring
  2. Spring Boot DevTools
  3. Spring AOP
  4. Spring Cloud Components
Popular Course in this category
Spring Boot Training Program (2 Courses, 3 Project)
  2 Online Courses |  3 Hands-on Projects |  22+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Spring Framework Training (4 Courses, 6 Projects)4.9
All in One Data Science Bundle (360+ Courses, 50+ projects)4.8
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

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

EDUCBA

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

Let’s Get Started

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
EDUCBA

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

Forgot Password?

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