pipeline {
    agent {
        docker {
            image 'openjdk:8-jdk'
        }
    }
    stages {
        stage('Build') {
            steps {
                sh './gradlew build javadoc publish'
            }
            post {
                success {
                    archiveArtifacts artifacts: 'build/libs/*', fingerprint: true

                    publishHTML target: [
                        allowMissing: false,
                        alwaysLinkToLastBuild: false,
                        keepAll: false,
                        reportDir: 'build/docs/javadoc',
                        reportFiles: 'index.html',
                        reportName: 'JavaDoc'
                    ]
                }
            }
        }
    }
}