0

I am trying to set up a CI pipeline in one of my maven projects and was confused about one of the concepts of Jenkins. below are the steps I did

  1. Created a maven Automation project in Java
  2. Installed a Jenkins -Server on my local machine
  3. created an SCM poll/WEBhooks Jenkins jobs for my maven project
  4. M2_HOME and JAVA_HOME are using local paths where java and maven is installed
  5. Had specified all the settings & commands need to run the project using maven from the local machine and things are running fine. I am using pom.xml and had specified path like this -> /Users/username/Desktop/Repos/SomeAutomationRepo/pom.xml

Now suppose, I moved my Jenkins to some remote server and now try to build and Run my Automation Suite from there, how should I configure Jenkins where my Local pom.xml is placed? I know we can use JAVA_HOME and M2_HOME on remote Jenkins but I am still confused about how pom.xml needs to be configured on remote Jenkins. Or if there is any configuration that on a remote machine when Jenkings will checkout repo of my project, any relative Pom.xml path can be given which is independent of local paths.

before posting this question I tried to find various resources out there on the internet but was able to find the integration of MVN + JENKINS on the same server only.

6
  • 1
    A standard Jeknins Configuration will have controller that dispatches jobs to agents. Agents will execute the job steps within a (usually ephemeral) workspace, typically, tbe first step of which is retrieve/update the source from a remote location, the build the application, test and deploy., So that's at least 3+ servers. Your pom.xml is part of your source code, in the source repo. Tools may be pre-installed on the agents or dynamically installed (Global Tools).
    – Ian W
    Jan 27, 2022 at 2:16
  • Thanks for sharing the info. will go through the link and check if that helps !!
    – Karan
    Jan 27, 2022 at 6:07
  • 1
    Actually, this may be a better tutorial, plus there's a more advanced series of tutorials on pipelines, here. Some more advanced infrastructure documentation fromAWS and Miscrosoft, too
    – Ian W
    Jan 27, 2022 at 7:17
  • i guess i was not able to ask question properly here , i actually want to run the automation suite mvn ( in git repo) on remote jenkins . for the same i found the solution by downloading maven plugin and creating maven project instead of Free style project . There i need just to mention room pom.xml of my REPO to run any goals . Thanks for the Excellent tutorials though @IanW
    – Karan
    Jan 27, 2022 at 17:52
  • The legacy "Maven Integration" plugin has a sordid reputation. It used to be bundled in core and now is a standalone plugin. It is not recommended to use type "Maven project" as it has maven hidden assumptions in its integration. Use a Freestyle or Pipeline project with a maven step (ie: ` sh 'mvn -B -DskipTests clean package'`.
    – Ian W
    Jan 27, 2022 at 20:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.