i am getting below error when i am running maven goals via Jenkinsfile. I am 
not getting this issue when i am running freestyle project with maven goals.


[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) 
on project server: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR]   C:\Program Files\Java\jre1.8.0_181\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.


below code has been put in Jenkinsfile.


does anyone how to fix this , FYI - JAVA_HOME is set to C:\Program 
Files\Java\jdk1.8.0_181


pipeline {
    agent any
    stages{
        stage('Build'){
            steps {
                bat 'mvn clean package'
            }
            post {
                success {
                    echo 'Now Archiving...'
                    archiveArtifacts artifacts: '**/target/*.war'
                }
            }
        }
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f257a74a-c2a8-42ce-89d4-7a69a3c85e52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to