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

Maven job config page loses 'invoke top-level maven targets' setting for 'use private repository'

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

      Using Jenkins 1.473, I am seeing an issue in a Maven project, when I use the 'Invoke top-level Maven targets' pre-build step.

      When I add this pre-biuld step, it comes with the 'Use private Maven repository' option checked. If I uncheck this option, and save the job, when I re-open the job, I see it is checked again. So it appears that the config page is losing my persisted setting, and always setting it back to the checked mode.

      The net result is that if you are using the 'Invoke top-level Maven targets' pre-build step, and dont the 'use private mavne repository' option checked, then each time you change your maven job, you need to go and uncheck that option before you click save.

          [JENKINS-14613] Maven job config page loses 'invoke top-level maven targets' setting for 'use private repository'

          evernat added a comment -

          reproduced with Jenkins 1.524

          evernat added a comment - reproduced with Jenkins 1.524

          sroth evernat I confirm your bug, I reproduced it (and JENKINS-37850 at the same time). In fact they are the same. The default value of "Use private Maven repository" seems to be forced by the global configuration "Manage Jenkins" > "Maven Project Configuration" > "Local Maven Repository"
          If you use "Local to the workspace" or "Local to the executor" the option "Use private Maven repository" of 'Invoke top-level Maven targets' pre-build or post build step will be always activated ( JENKINS-14613 )
          If you use "Default ( ~/.m2/repository)" the option "Use private Maven repository" of 'Invoke top-level Maven targets' pre-build or post build step will be always deactivated ( JENKINS-37850 )
          As far as I can see the value of "Use private Maven repository" is correctly saved in the job configuration thus there is a side effect in the loading of the value when we are displaying the form

          Arnaud Héritier added a comment - sroth evernat I confirm your bug, I reproduced it (and JENKINS-37850 at the same time). In fact they are the same. The default value of "Use private Maven repository" seems to be forced by the global configuration "Manage Jenkins" > "Maven Project Configuration" > "Local Maven Repository" If you use "Local to the workspace" or "Local to the executor" the option "Use private Maven repository" of 'Invoke top-level Maven targets' pre-build or post build step will be always activated ( JENKINS-14613 ) If you use "Default ( ~/.m2/repository)" the option "Use private Maven repository" of 'Invoke top-level Maven targets' pre-build or post build step will be always deactivated ( JENKINS-37850 ) As far as I can see the value of "Use private Maven repository" is correctly saved in the job configuration thus there is a side effect in the loading of the value when we are displaying the form

          strangely the problem doesn't occur with a classical freestyle job thus it is really a side effect of pre/post build steps in maven jobs which is interfering with maven freestyle builders

          Arnaud Héritier added a comment - strangely the problem doesn't occur with a classical freestyle job thus it is really a side effect of pre/post build steps in maven jobs which is interfering with maven freestyle builders

          Hatem Ahmed added a comment -

          Using Jenkins ver. 2.101

          The only configuration where I was able to persist the unchecked option in a Maven Job was as follows:

          1. Manage Jenkins > Configure System > Maven Project Configuration > Local Maven Repository: Default (~/.m2/repository)
          2. In the Maven Job, make sure the build step is not using a private repository

          This way when I uncheck (Use private Maven repository) option in my (Invoke top-level Maven targets) step, it persists.

           

          Now if I want to set my maven repository to be local to the executor, I have to do it manually by passing a (-Dmaven.repo.local=${JENKINS_HOME}/maven-repositories/${EXECUTOR_NUMBER}) argument to the Maven step intended. Which is not ideal.

          It would be nice to have these 3 places un-linked somehow 

          1. Jenkins Maven Setup
          2. Build step in Maven Job
          3. (Invoke top-level Maven targets) step.

          As Arnaud mentioned earlier, I don't run into this problem if I'm using a freestyle job.

           

          Would be also nice if (Invoke top-level Maven targets) step allowed choosing (local to the executor) as an option of private repo. But that's another thing.

          Hatem Ahmed added a comment - Using Jenkins ver. 2.101 The only configuration where I was able to persist the unchecked option in a Maven Job was as follows: Manage Jenkins > Configure System > Maven Project Configuration > Local Maven Repository: Default (~/.m2/repository) In the Maven Job, make sure the build step is not using a private repository This way when I uncheck (Use private Maven repository) option in my (Invoke top-level Maven targets) step, it persists.   Now if I want to set my maven repository to be local to the executor, I have to do it manually by passing a (-Dmaven.repo.local=${JENKINS_HOME}/maven-repositories/${EXECUTOR_NUMBER}) argument to the Maven step intended. Which is not ideal. It would be nice to have these 3 places un-linked somehow  Jenkins Maven Setup Build step in Maven Job (Invoke top-level Maven targets) step. As Arnaud mentioned earlier, I don't run into this problem if I'm using a freestyle job.   Would be also nice if (Invoke top-level Maven targets) step allowed choosing (local to the executor) as an option of private repo. But that's another thing.

            Unassigned Unassigned
            sroth Steve Roth
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: