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.

torek
  • 448,244
  • 59
  • 642
  • 775
Karan
  • 443
  • 5
  • 14
  • 1
    A standard [Jeknins Configuration](https://www.cloudbees.com/blog/building-resilient-jenkins-infrastructure) 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 '22 at 02:16
  • Thanks for sharing the info. will go through the link and check if that helps !! – Karan Jan 27 '22 at 06:07
  • 1
    Actually, this may be a [better tutorial](https://digitalvarys.com/how-to-configure-jenkins-master-slave-setup/), plus there's a more advanced series of tutorials on [pipelines, here](https://github.com/ssbostan/jenkins-tutorial). Some more advanced infrastructure documentation from[AWS](https://aws.amazon.com/blogs/opensource/why-jenkins-still-continuously-serves-developers/) and [Miscrosoft](https://learn.microsoft.com/en-us/azure/architecture/solution-ideas/articles/immutable-infrastructure-cicd-using-jenkins-and-terraform-on-azure-virtual-architecture-overview), too – Ian W Jan 27 '22 at 07: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 '22 at 17:52
  • The legacy ["Maven Integration" plugin](https://plugins.jenkins.io/maven-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](https://i.stack.imgur.com/vgK8p.png) or [Pipeline project](https://www.jenkins.io/doc/tutorials/build-a-java-app-with-maven/#add-a-test-stage-to-your-pipeline) with a maven step (ie: ` sh 'mvn -B -DskipTests clean package'`. – Ian W Jan 27 '22 at 20:47
  • Sure @IanW. Thanks for the clarifications on that. will do integration as per suggested and raise any issue if found – Karan Jan 31 '22 at 06:29

0 Answers0