Junior — Middle
Describe how automation of build and deployment is implemented in your latest project.
sobes.tech AI
Answer from AI
In my latest Java project, build automation and deployment were implemented using Jenkins and Maven. Maven was used for dependency management and project build, while Jenkins was used for automatically triggering builds on each commit to the repository.
The process looked like this:
- When a push was made to GitHub, Jenkins was triggered via webhook.
- Jenkins ran Maven commands to compile, test, and build artifacts.
- If the build and tests were successful, Jenkins automatically deployed the application to a test server.
An example Jenkinsfile for such a pipeline:
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'mvn clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
}
stage('Deploy') {
steps {
// deployment script to test server
sh './deploy.sh'
}
}
}
}
Thus, the entire cycle from commit to deployment was automated, which accelerated integration and reduced errors.