Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-19188

Unable to set local maven repository at Jenkins or Job level

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • maven-plugin
    • None

      Current version of Jenkins used: 1.527

      I am unable to set the "Local Maven Repository" to either "Local to the executor" or "Local to the workspace" at the Jenkins system level. I also cannot configure this at the job level under "Use private Maven repository".

      As a work around, I have tried to override the local repo by setting localRepository in the settings.xml file to /home/jenkins/.m2 (which does exist), however this does not seem to get used during "Parsing POMS" either.

      The resulting log output is (which reflects the default ~/.m2 location):

      Parsing POMs
      ERROR: Failed to create /usr/share/tomcat6/.m2
      Finished: FAILURE

      Note: I have tested this same setup locally using Jenkins 1.519 and it correctly overrides the local repo as I would expect:

      [DEBUG] (f) localRepository = id: local
      url: file:///Users/jenna.pederson/.jenkins/jobs/my-maven-jenkins-job/workspace/.repository

          [JENKINS-19188] Unable to set local maven repository at Jenkins or Job level

          Jenna,

          Do you still have the issue? I'm trying to reproduce it in Jenkins 1.536, and the repo location is correctly configured, both in job and system level.

          Regards.

          Marcelo Rebasti

          Marcelo Rebasti added a comment - Jenna, Do you still have the issue? I'm trying to reproduce it in Jenkins 1.536, and the repo location is correctly configured, both in job and system level. Regards. Marcelo Rebasti

          Oleg Nenashev added a comment -

          No response from the submitter

          Oleg Nenashev added a comment - No response from the submitter

          Juan Sanchez added a comment -

          Hi how are you? I have the same problem right now,

          I am executing jenkins in linux but I do not have root access, so, I modify th hudson atribute in web.xml to change the path where jboss deploy jenkins. But the problem is when the job run and at the end the job fail because Jenkins try to create a .m2 in a home/$USER$/ path but this path dos not exist so the job breaks and finished not well.

          I am reading about this issue and I have tried to modify in the jenkins management module choosing the maven option related with the repository location changing it to local to workspace but this doesnt work either.

          Juan Sanchez added a comment - Hi how are you? I have the same problem right now, I am executing jenkins in linux but I do not have root access, so, I modify th hudson atribute in web.xml to change the path where jboss deploy jenkins. But the problem is when the job run and at the end the job fail because Jenkins try to create a .m2 in a home/$USER$/ path but this path dos not exist so the job breaks and finished not well. I am reading about this issue and I have tried to modify in the jenkins management module choosing the maven option related with the repository location changing it to local to workspace but this doesnt work either.

          Josivan Souza added a comment -

          Hello I'm facing the same problem. There is no home path to my jetty user.

          Take a look in the last line of console output.

          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD SUCCESS
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 8.087 s
          [INFO] Finished at: 2016-02-19T00:08:20-02:00
          [INFO] Final Memory: 14M/35M
          [INFO] ------------------------------------------------------------------------
          Parsing POMs
          ERROR: Failed to create /home/jetty/.m2
          An attempt to send an e-mail to empty list of recipients, ignored.
          Finished: FAILURE
          

          Josivan Souza added a comment - Hello I'm facing the same problem. There is no home path to my jetty user. Take a look in the last line of console output. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 8.087 s [INFO] Finished at: 2016-02-19T00:08:20-02:00 [INFO] Final Memory: 14M/35M [INFO] ------------------------------------------------------------------------ Parsing POMs ERROR: Failed to create /home/jetty/.m2 An attempt to send an e-mail to empty list of recipients, ignored. Finished: FAILURE

          Indra Gunawan added a comment -

          This is happening with Jenkins LTS 1.625.3 and maven Integration plugin version 2.7.1

          22:58:19 Parsing POMs
          22:58:19 ERROR: Failed to create /users/<jenkins-user>/.m2

          The job is a Maven2/3 Type triggered by Gerrit and it is already configured to use local workspace as local maven repository.

          Somehow, this can't be overridden. We do not want to fill up the HOME directory of Jenkins generic user of the .m2 repo.

          Indra Gunawan added a comment - This is happening with Jenkins LTS 1.625.3 and maven Integration plugin version 2.7.1 22:58:19 Parsing POMs 22:58:19 ERROR: Failed to create /users/<jenkins-user>/.m2 The job is a Maven2/3 Type triggered by Gerrit and it is already configured to use local workspace as local maven repository. Somehow, this can't be overridden. We do not want to fill up the HOME directory of Jenkins generic user of the .m2 repo.

          Hello,
          In fact, the problem seems to occur before launching maven.
          I can reproduce it, on Linux +jenkins 2.32, with ${HOME}/.m2 being a soft link to a non existing folder.
          I guess that it tests if ${HOME}/.m2 is a directory, and if not tries to mkdir it, which is not possible since there is already a link using the name.
          Once the target of ${HOME}/.m2 created, I saw that no files were stored in it : artefacts were downloaded to ${WORSPACE}/.repository, as configured.

          Jérôme GRANDJEAN added a comment - Hello, In fact, the problem seems to occur before launching maven. I can reproduce it, on Linux +jenkins 2.32, with ${HOME}/.m2 being a soft link to a non existing folder. I guess that it tests if ${HOME}/.m2 is a directory, and if not tries to mkdir it, which is not possible since there is already a link using the name. Once the target of ${HOME}/.m2 created, I saw that no files were stored in it : artefacts were downloaded to ${WORSPACE}/.repository , as configured.

          Sheng Fang added a comment - - edited

          Hello,

          I have the same issue. The version of my jenkins is 2.176.1 and the version of maven plugin is 3.3。If I checked the option "Use private Maven repository", it did work. However, if I set the value of "Local Maven Repository“ to "Local to the workspace" in Configure System area, it didn't work.

           

          Sheng Fang added a comment - - edited Hello, I have the same issue. The version of my jenkins is 2.176.1 and the version of maven plugin is 3.3。If I checked the option "Use private Maven repository", it did work. However, if I set the value of "Local Maven Repository“ to "Local to the workspace" in Configure System area, it didn't work.  

            jennapederson Jenna Pederson
            jennapederson Jenna Pederson
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: