Jenkins est un outil d'intégration continue open-source conçu pour automatiser le développement de logiciels. Il permet aux développeurs d'intégrer facilement leurs modifications de code et de déployer des applications de manière fluide.
Suivez ces étapes pour installer Jenkins :
http://localhost:8080.pom.xml et précisez les objectifs Maven (par exemple, clean install).pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
</plugins>
</build>
</project>
Jenkinsfile dans votre dépôt.
pipeline {
agent any
stages {
stage('Cloner le dépôt') {
steps {
git url: 'https://github.com/utilisateur/projet.git'
}
}
stage('Construire') {
steps {
sh 'mvn clean install'
}
}
stage('Tests') {
steps {
sh 'mvn test'
}
}
stage('Déployer') {
steps {
echo 'Déploiement en cours...'
}
}
}
post {
success {
echo 'Pipeline exécuté avec succès.'
}
failure {
echo 'La pipeline a échoué.'
}
}
}