1

I have a project in Java and I also used Gradle and TestNG. It works perfectly without jenkins.

After that I configured Jenkins and now I can run the code with Gradle command in Jenkins on my Local.

Then I tried to run the code on Slave machine. I can see the Slave machine in Jenkins nodes. I also configured Gradle and Java to run on Slave machine. I have to mention that I don't use Version Control in this project.

When I start the job in Jenkins to run on Slave machine, it starts the job but the problem is, it cannot find for example the gradle.build, as it's located in my Local machine and not in Slave machine.

The question is, should I use Version Control? is it going to solve the problem? or should I use Copy Artifact Plugin ?

Complementary Question: If I make a local git for my network on the same machine that runs Jenkins, it is going to be a problem?

Thanks for your help :)

0xM4x
  • 460
  • 1
  • 8
  • 19
  • 1
    There is no good reason why you should not be using version control. In other words, USE IT. Git is universal. Word offers version control for docs, so does G-suite. One day it will save your butt and you'll be glad you had it. I wish I had known about ghat in uni, but the we did not have Linux then either.Same thing for a working backup/recovery process. – Ian W Oct 25 '19 at 10:34
  • you're right. but the he problem is, I don't want to upload it anywhere. in this case I have to set up git server on my local machine. I'm wondering if it's going to make conflict with Jenkins or not? – 0xM4x Oct 25 '19 at 11:35
  • 1
    You do not need to upload anything anywhere. Download and install [Git](https://git-scm.com), run [`git init`](https://git-scm.com/docs/git-init) at your base directory and you have a local repo to use for version control. Run [`git add`](https://git-scm.com/docs/git-add) to add the content. You are now using version control. Jenkins can [access it locally too](https://stackoverflow.com/questions/10498554/jenkins-linking-to-my-local-git-repository) – Ian W Oct 25 '19 at 21:08

1 Answers1

2

Slave machine need your file gradle.build, so either place it there manually by SFTP. If your gradle.build going to change regularly then its prefer to use version control like git by which jenkins will fetch the latest files.

Again its not mandatory but recommended to use version control like git to prevent from unnecessary errors

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
  • Thanks for your answer. and in case of not using version control, **Copy Artifact Plugin** will help? even if I have some changes in files, it will update automatically? – 0xM4x Oct 25 '19 at 08:55
  • 1
    No, Artifact Plugin is basically to move your reports and other stuff, its basically to create history like logs etc build vice, while gradle.build is a main file which required to download dependency and build project. so basically its not an good idea to use Artifact Plugin for this – Shubham Jain Oct 25 '19 at 08:58