0

i have installed Jenkins on Windows 10 and each time i try to execute a maven project or just try to execute mvn clean test (command line), Jenkins decides that my new workspace should be: C:\Windows\system32\config\systemprofile\eclipse-workspace\ while my project is in C:\Users\username\eclipse-workspace. Jenkins starts in the directory C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins.jenkins\workspace\projectName and even if i run a cd command i will have this problem:

The driver executable must exist: C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe

My chrome driver is not there obviously but it's in C:\Users\userName\eclipse-workspace\projectName\drivers\chromedriver.

It looks like than Jenkins changes my user.home. I went to config file and set:

<workspaceDir>C:\Users\userName\eclipse-workspace</workspaceDir>

but it's still looking for the driver in C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe

This part: C:\Windows\system32\config\systemprofile\ is obtained using in Java System.getProperty("user.home"). Running it with Jenkins seems to modify it.

Why is it looking for my driver there? Why can't it just stick to my workspace folder? How can i solve this?

Thank you

CCC
  • 170
  • 1
  • 15
  • update: tried to set a path without variables in Java and it is still looking for the driver in C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe – CCC Jul 29 '20 at 14:14
  • update2: i tried to change Path variable in Jenkins, didn't work. I also added user.home in Jenkin environment variables and changed USERPROFILE variable. Nothing worked so far. – CCC Jul 29 '20 at 15:06
  • Running Jenkins on Windows is a bad idea! Sorry, had to say it. It looks like you have to make some changes on local system `$PATH` and `Environment Variables` . Have you tried writing a `Hello world` directly in the path where it wants to build i.e., C:\Windows\system32\config\systemprofile\eclipse-workspace\ . If it is working in its own preferred workspace, changing to that point may be an easier option. Please refer this: https://stackoverflow.com/questions/34854377/how-to-change-workspace-and-build-record-root-directory-on-jenkins – mdabdullah Jul 29 '20 at 18:17
  • Thank you mdabdullah, Jenkins on Windows was not my choiche, i am in a corporate environment, so i guess i have to work with what i am given....honestly i would not like to change my workspace directory just because of Jenkins – CCC Jul 30 '20 at 07:08
  • tried to edit `config.xml`. It started a new installation, but it's still going for `C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe`. i edited my Java class so that i do not use `user.home` variable, still not wrking `System.setProperty("webdriver.chrome.driver", "C:\\Users\\user\\eclipse-workspace\\project\\drivers\\chromedriver\\chromedriver.exe");` – CCC Jul 30 '20 at 07:42
  • If i use the `war` file it does not happen. It happens only when installing Jenkins as `windows service` – CCC Jul 30 '20 at 08:37
  • While I dont fully understand the problem, I do appreciate it I have only setup windows slaves and things were simpler. Setting up `master` on Windows may not be as simple. I recommend you align to jenkins because there are more hardcoded paths coming along the way like `slave path` , `environment variables` , `build logs` etc which appears to be a growing problem. – mdabdullah Jul 30 '20 at 11:08

1 Answers1

3

I think i solved it. I was running under Local System Account https://jenkins-le-guide-complet.github.io/html/sect-windows-service.html#fig-hudson-windows-service-config

I had edit the service as shown in the link.

CCC
  • 170
  • 1
  • 15