Error : Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
I am trying to create a pipeline using cloudbees core. But getting issue with following error :
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
The error i am getting when trying to execute withMaven() piece of code
outside withMaven() all the following commands
sh "echo $PATH"
sh "echo $JAVA_HOME"
sh "echo $MAVEN_HOME"
sh "echo $M3_HOME"
sh "mvn --version"
sh "java -version"
are working fine. but when it is trying to execute withMaven()
then getting the error :
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
Here is my pipeline
node("checkout-and-build") {
stage('Get a Maven project') {
git 'https://github.com/cloudbees-community/game-of-life.git'
//checkout scm
container('checkout-and-build') {
stage('Build a Maven project') {
sh "echo $PATH"
sh "echo $JAVA_HOME"
sh "echo $MAVEN_HOME"
sh "echo $M3_HOME"
sh "mvn --version"
sh "java -version"
//steps {
//script {
// Run the maven build
withMaven(
//mavenLocalRepo: '.repository',
mavenSettingsConfig: 'cb61e328-dcee-4c95-b3e0-7a7c9d17187b'
//mavenSettingsConfig : 'NexusMavenSettings'
//jdk: 'java-1.8-openjdk',
//publisherStrategy: 'EXPLICIT'
) {
sh "java -version"
sh 'mvn -version'
}
//}
//}
//withMaven(mavenSettingsConfig:'cb61e328-dcee-4c95-b3e0-7a7c9d17187b') {
//sh 'mvn clean install'
//}
}
}
}
}
}
-- Any help to resolve the issue is welcome in advance
-
How is deployed maven ? Locally on the host ? Using Jenkins ?
What is it's version ?
I would recommend to not set anything for `$MAVEN_HOME` `$M3_HOME`
I never saw this error and I don't see something similar in the plugin issues: https://issues.jenkins-ci.org/issues/?jql=project%20%3D%20JENKINS%20AND%20component%20%3D%20pipeline-maven-plugin
This error smells for me a conflict between `MAVEN_HOME` and the version of maven in the PATH
0
Please sign in to leave a comment.
Comments
1 comment