I have maven installed in my windows machine (here is the path: C:\Program Files\apache-maven-3.8.4) and Jenkins running in a docker container.
When I try to add maven path in Jenkins >> Global Tools Configuration, It is giving me the following error
C:\Program Files\apache-maven-3.8.4\ is not a directory on the Jenkins controller (but perhaps it exists on some agents)
Is it possible to refer locally installed maven or JDK path in Jenkins which is running in a docker container? If yes, can you provide a sample working path
@halkeye Thanks for the response. If I understand correctly you are suggesting me to mount the following folder(s) to docker Jenkins volumes? please correct me if my understanding is wrong.
C:\Program Files\apache-maven-3.8.4\ and also .m2 repo folder
I have seen creating volumes to copy docker container folders to local machine for persistence purpose using -v or volumes option. However, I have not seen an option for other way round (like mounting local folder to docker jenkins). Can you please provide any reference or sample command?
While it might be technically possible to make that path visible in your container I think that you are conceptionally on the wrong way. It does not make sense to use a Java or Maven installation from outside the container. Just let your builds run on an agent that contains the correct tools. Or use Jenkins’ tool installation to install the correct tools automatically.