pipeline {
    agent any

    triggers {
        pollSCM('')
    }

    stages {
        stage('Build') {
            tools {
                jdk "jdk17"
            }
            steps {
                withGradle {
                    sh './gradlew build'
                }
            }
        }
    }

    post {
        always {
            archiveArtifacts artifacts: '**/build/distributions/*.*', fingerprint: true
            junit '**/build/test-results/test/*.xml'
            step([$class                  : 'Mailer',
                  notifyEveryUnstableBuild: true,
                  recipients              : [emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])].join(' ')])
        }
    }}