📚 Cheatsheet

Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.

Snippets 6

Retour
Bloc de build
Facile
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.8.1</version>
    </plugin>
  </plugins>
</build>
Bloc de dépendances
Facile
<dependencies>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13.2</version>
    <scope>test</scope>
  </dependency>
</dependencies>
Bloc de propriétés
Facile
<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <java.version>11</java.version>
</properties>
Définir le packaging (jar, war, ear...)
Facile
<project>
  ...
  <packaging>war</packaging>
</project>
Héritage d'un parent POM
Intermédiaire
<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>2.6.4</version>
  <relativePath/> <!-- lookup parent from repository -->
</parent>
Structure minimale d'un pom.xml
Facile
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>mon-app</artifactId>
  <version>1.0-SNAPSHOT</version>
</project>