我正在使用 Jenkins,并使用 Blue Ocean 創建了此管道,并且在運行管道時出現此錯誤
我該如何解決這個問題?
這是我的 Jenkins 檔案代碼,當我在本地存盤庫中運行 gradle build gradle javadoc 時它可以作業,但是當我在 Jenkins 服務器中運行它時它不起作用
pipeline {
agent any
stages {
stage('Build') {
steps {
bat 'gradle build'
bat 'gradle javadoc'
archiveArtifacts 'build/libs/*.jar'
archiveArtifacts 'build/docs/javadoc/**'
junit 'build/test-results/test/*.xml'
}
}
stage('Mail Notification') {
steps {
mail(subject: 'Build Notification', body: 'This is a notification letting you know that the build stage has finished', to: '[email protected]', cc: '[email protected]', from: '[email protected]')
}
}
stage('Code Analysis') {
parallel {
stage('Code Analysis') {
steps {
withSonarQubeEnv('sonar') {
bat 'gradle sonarQube'
}
waitForQualityGate true
}
}
stage('Test Reporting') {
steps {
cucumber 'reports/example-report.json'
}
}
}
}
stage('Deployment') {
steps {
bat 'gradle publish'
}
}
stage('Slack Notification') {
steps {
slackSend(baseUrl: 'https://hooks.slack.com/services', channel: '#tp-ogl', notifyCommitters: true, sendAsText: true, username: 'ik_mehar', message: 'This is a slack notification letting you know that he process has finished ', replyBroadcast: true, teamDomain: 'https://app.slack.com/client', token: 'T02T8KCN5DY/B02T22U3D8W/sn96ULIXJfQN7FOkx21nm84s')
}
}
}
}
uj5u.com熱心網友回復:
模塊匯出錯誤表明您的 Jenkins 環境中使用的 Java 版本與您的專案的 Gradle 版本不兼容。
在不知道 Jenkins 環境中使用的 Java 版本和本地機器上的 Java 版本的情況下,您需要確保 Jenkins 環境中的 Java 版本與專案中使用的 Gradle 版本兼容。
查看兼容性矩陣以確定哪個 Gradle 版本和 Java 版本兼容:https ://docs.gradle.org/current/userguide/compatibility.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/434120.html
