How to configure Maven in Jenkins-
I HOPE BELOW INFORMATION MAY HELP YOU
I. Configure Maven in Jenkins
1. Go to Jenkins Dashboard ->Manage Jenkins ->Manage plugins ->Available ->Maven Integration ->Install
2. Go to Manage Jenkins->Global tool configuration->Maven -> Add Maven_home variable value (i.e. path of the maven file on your system).
3. Go to Jenkins Dashboard -> New Item -> Maven Project option will be available
II. Build a Maven project
- Go to Jenkins Dashboard -> New Item -> Choose name for the Maven Project (e.g. MyFirstMavenExample)
2. On Configure Page, set the following:
a). Discard Old builds
Days to keep builds: 1
Max of builds to keep: 5
b). JDK (to be used for this project) Java-1.8
c). Build -> adavanced -> enable the following
- Resolve Dependencies during Pom parsing
- Use custom workspace (add path of the folder containing pom.xml)
-Goals & Options = Clean Compile Test
3). Apply & Save
4). Go to Project Window and Click ‘Build Now’.
*Error : Compilation error - No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?Probable cause: not able to connect to/find jdk.Solution:1. Go to Jenkins dashboard -> Manage Jenkins -> Configure System -> Global properties -> Add Environment Variable :JAVA_HOME and value2. Also check in the system of your windows :System -> advanced settings -> environment variablesSet the PATH : Append with the folder path of the jdkIf, user variable is pointing towards JRE, then update it to point towards java path.