Understand Dependencies & Maven - rlossec/planet-pulse GitHub Wiki

Installation

  1. Download Maven 3.10.0: here
  2. Add to the environment variables in PATH, the path to the bin in the downloaded binary folder.
  3. Next test if its correctly installed with : mvn -v

Maven Phases

Although hardly a comprehensive list, these are the most common default lifecycle phases executed.

  • 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 distributable format, such as a JAR.
  • integration-test : process and deploy the package if necessary into an environment where integration tests can be run
  • verify : run any checks to verify the package is valid and meets quality criteria
  • install : install the package into the local repository, for use as a dependency in other projects locally
  • deploy : done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

There are two other Maven lifecycles of note beyond the default list above. They are

  • clean: cleans up artifacts created by prior builds
  • site : generates site documentation for this project

Dependencies

Basics

  1. spring-boot-starter-web : Spring MVC.
spring-boot-starter-web
├── spring-boot-starter-jackson
├── spring-boot-starter-tomcat
├── spring-boot-http-converter
└── spring-boot-webmvc

1.1. Serveur Apache Tomcat

spring-boot-starter-tomcat · tomcat-embed-core

Tomcat reçoit les connexions HTTP et les transmet à l'application web. La version embarquée permet de démarrer l'application sans installer un serveur Tomcat séparément.

1.2. Framework web — Spring MVC

spring-webmvc · spring-web · spring-context

C'est le cœur du traitement des requêtes dans ton application : controllers, gestion des routes, composants Spring et intégration web.

1.3. Sérialisation — Jackson

spring-boot-starter-jackson · jackson-databind

Convertit les objets Java en JSON pour les réponses HTTP et, dans les configurations adaptées, le JSON reçu en objets Java.

GitHub - FasterXML/jackson: Main Portal page for the Jackson project

1.4. Journalisation — SLF4J et Logback

spring-boot-starter-logging · logback-classic · slf4j-api

Permet d'émettre des logs pour comprendre ce qui se passe dans l'application, diagnostiquer des erreurs et suivre son exécution.

Best Practices in Java Logging for Better Application Logging

1.5. Tests — JUnit, Mockito, AssertJ

spring-boot-starter-test

JUnit exécute les tests, Mockito permet de simuler des dépendances et AssertJ facilite l'écriture d'assertions lisibles.

JUnit

Dev dependencies

  1. spring-boot-maven-plugin : Build Jar archive (nested)
  2. spring-boot-starter-webmvc-test