I am using Jenkins and I create this pipeline with Blue Ocean and I am getting this error when running the pipeline
How can I fix this problem?
Here is my Jenkins file code when I run gradle build gradle javadoc in local repository it works but when I run it in Jenkins server it doesn't work
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')
}
}
}
}
CodePudding user response:
The module export error indicates an incompatibility of the version of Java used in your Jenkins environment and the version of Gradle for your project.
Without knowing the version of Java used in your Jenkins environment and the one on your local machine, you need to ensure that that one in your Jenkins environment is compatible with the version of Gradle used in the project.
See the compatibility matrix to figure out which Gradle version and Java version are compatible: https://docs.gradle.org/current/userguide/compatibility.html