为什么.settings文件丢失

时间:2019-09-26 14:50:39

标签: java jenkins groovy jenkins-plugins

我无法在Maven中建立存储。设置文件丢失。 jenkinsfile中有这样的代码。如果它不在存储库本身中,如何引用?帮助我了解


    stages {

        stage("Copying credentials files") {
            steps {
                withCredentials([file(credentialsId: 'settings.xml', variable: 'SETTINGS'), file(credentialsId: 'settings-security.xml', variable: 'SETTINGS_SECURITY')]) {
                    bat '''COPY %SETTINGS% %WORKSPACE%'''
                    bat '''COPY %SETTINGS_SECURITY% %WORKSPACE%'''
                }
            }
        }
        stage("Test") {
            steps {
                script {
                    try {
                        bat "mvn clean install -s settings.xml -Dsettings.security=settings-security.xml -DTagConfigFile=${configFile} -DTAGS=${tags}"
                    } catch (err) {
                        currentBuild.result = 'FAILURE'
                        throw err
                    } finally {
                        stage("Allure report") {
                            allure([
                                    commandline      : '2.8.0',
                                    includeProperties: false,
                                    jdk              : '',
                                    properties       : [],
                                    reportBuildPolicy: 'ALWAYS',
                                    report           : 'target/allure-report',
                                    results          : [[path: 'target/allure-results']]
                            ])
                        }
                    }
                }
            }
        }
    }
}

1 个答案:

答案 0 :(得分:0)

jenkinsfile与无关。原来,另一个程序员错误地从项目中删除了settings.xml。添加它可以解决问题