✍️
Notes.md
  • Table of contents
  • React.Js
    • React Hooks
    • Old :- React : Using Classes
  • Blockchain
    • Solidity
    • Custom ERC20 token
    • Contract
  • Tools and Tech
    • Docker
    • Git version Control
  • Java
    • Data & Data Types
    • IO in Java
    • Data Structures
      • Array in Java
      • Collections in Java
      • Map in Java
      • Enums in Java
      • Linked List in Java
      • List in Java
      • Queues & Stacks
      • Set in Java
      • TreeSet and TreeMap
    • Object Oriented Programming
      • Object Class Methods and Constructor
      • Immutable Class & Objects
      • Constructors
      • Visibility
      • Generics
    • Threads in Java
    • Useful Stuff Java
      • Lambda & Stream
    • Keywords in Java
      • Annotations
      • Comparators
      • Packages in Java
    • Miscellaneous
    • Articles to refer to
  • Golang
    • Competitive Programming in Go
    • Testing simple web server
    • Learning Go : Part 1
    • Maps vs slices
    • Golang Garbage Collector 101
    • Things Golang do differently
    • Go Things
  • Linux
    • Shell programming
    • Linux Commands Part 1 - 4
    • Linux Commands Part 5 - 8
    • Linux Commands Part 9 - 10
  • Software Design
    • Solid Design
    • OOPS
    • Design Patterns
      • Creational Design Pattern
        • Builder DP
        • Factory DP
        • Singleton DP
      • Adapter DP
      • Bridge DP
      • Iterator DP
      • State DP
      • Strategy DP
      • Behavioral Design Pattern
        • Observer DP
      • Structural Design Pattern
        • Facade DP
  • Cloud
    • Google Cloud Platform
      • GCP Core Infrastructure
      • Cloud Networking
  • Spring Boot
    • Spring Basics
      • Spring Beans
      • Important Annotations
      • Important Spring Things
      • Maven Things
      • Spring A.O.P
    • Spring Boot Controller
      • Response Entity Exception Handling
    • Spring Things
    • Spring MVC
    • Spring Data
      • Redis
      • Spring Data JPA
      • JDBC
    • Apache Camel
  • Miscellaneous
    • Troubleshooting and Debugging
Powered by GitBook
On this page
  • Missing pom.xml version
  • Maven Build Phases

Was this helpful?

  1. Spring Boot
  2. Spring Basics

Maven Things

Everything related to maven

Missing pom.xml version

If version in pom.xml isnt mentioned, then how does spring boot know which version to use ?

The version belonging the parent module will be referenced. Spring Boot starter comes with a lot of libraries in-built, with is referenced as a parent in the pom.xml file of your project

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.7.0</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
  • Click on spring-boot-starter-parent and to open its' pom.xml and then open spring-boot-dependencies and you will find the list of version of each dependencies mentioned in it, used the specific spring-boot version you are using.

Now, if we have a child module in our spring application, and if we dont specify the version number, we either need to mention the parent pom or specify the version there.

<!-- referencing parent pom.xml -->
        <parent>
        <groupId>com.example</groupId>
        <artifactId>spring-demo</artifactId>
        <version>0.0.1</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

or you can the specify the version inside the dependency tag or in the properties tag

	<properties>
		<java.version>17</java.version>
		<lombok.version>1.18.18</lombok.version> <!-- example -->
	</properties>

You can also exclude the child module ( if you want to use another implementation ) from the parent pom.

Example : Excluding the artifactedId hamcrest-core from junit.

<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>4.12</version>
				<scope>test</scope>
				<exclusions>
					<exclusion>
						<groupId>org.hamcrest</groupId>
						<artifactId>hamcrest-core</artifactId>
					</exclusion>
				</exclusions>
			</dependency>
		</dependencies>
	</dependencyManagement>
  • Check the maven tab, you will find that hamcrest-core is no longer a sub-dependency of junit and will also find the exact version.

Maven Build Phases

  • validate - validate the project is correct and all necessary information is available

  • compile - compile the source code of the project

  • test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed

  • package - take the compiled code and package it in its distributed format, such as a JAR.

  • verify - run any checks on results of integration tests to ensure quality criteria are met

  • install - install the package into the local repository, for use as a dependency in other projects locally

  • deploy - done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.

PreviousImportant Spring ThingsNextSpring A.O.P

Last updated 2 years ago

Was this helpful?