Maven
  1. Maven
  2. MNG-3525

Settings.xml allowing mirror definitions inside profiles

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.9
    • Component/s: Profiles
    • Labels:
      None
    • Environment:
      N/A

      Description

      I currently use Maven in 2 places
      1. At work
      2. Not at work

      At work we have a repository manager thus we have mirror properties in the settings.xml for the whole teams global settings. We also have a defined a number of repositories in our work profile so we can mirror these to different repo's managed by Archiva. Now when I work from home I have to comment out the mirror definitions and activate a home profile which does not define any repos so Maven just goes out to the WWW as normal. So the pain is having to comment out and un-comment the mirror settings every time I go from work to home and visa-versa.

      Can we not have the option to add mirrors inside profiles?

        Issue Links

          Activity

          Hide
          Rob Evans added a comment -

          Could profiles help?

          Show
          Rob Evans added a comment - Could profiles help?
          Hide
          olle added a comment -

          I solve this issue with a Groovy script to flip a lot of settings on SuSE laptop.

          This actually might be solved with a nice small maven plugin to activate/disactive profiles in settings.xml

          Show
          olle added a comment - I solve this issue with a Groovy script to flip a lot of settings on SuSE laptop. This actually might be solved with a nice small maven plugin to activate/disactive profiles in settings.xml
          Hide
          Paul Gribben added a comment -

          Rob - Profiles would help if the settings xml schema allowed mirrors in profiles but it does not. That is exactly my issue.

          Oleg - What sort of things do you use you groovy script for?

          Show
          Paul Gribben added a comment - Rob - Profiles would help if the settings xml schema allowed mirrors in profiles but it does not. That is exactly my issue. Oleg - What sort of things do you use you groovy script for?
          Hide
          Brian E. Fox added a comment -

          This is definitely a requirement for 2.1 IMO, but it can't happen on 2.0.x.

          Show
          Brian E. Fox added a comment - This is definitely a requirement for 2.1 IMO, but it can't happen on 2.0.x.
          Hide
          David J. M. Karlsen added a comment -

          This would most definately be useful for ppl going in and out of different environments.
          Can it be resceduled for 2.1.x?

          Show
          David J. M. Karlsen added a comment - This would most definately be useful for ppl going in and out of different environments. Can it be resceduled for 2.1.x?
          Hide
          Brian E. Fox added a comment -

          2.1 can't handle a model change yet so most likely no for 2.x

          Show
          Brian E. Fox added a comment - 2.1 can't handle a model change yet so most likely no for 2.x
          Hide
          Frank Jakop added a comment -

          Well, 3.x is out in the field for quite a while. We would appreciate this feature very much.

          Show
          Frank Jakop added a comment - Well, 3.x is out in the field for quite a while. We would appreciate this feature very much.
          Hide
          Christoffer Soop added a comment -

          Ditto - please implement this feature ASAP!

          You should also add support for adding proxies to profiles.

          Show
          Christoffer Soop added a comment - Ditto - please implement this feature ASAP! You should also add support for adding proxies to profiles.
          Hide
          marian added a comment -

          Very useful option...

          Show
          marian added a comment - Very useful option...
          Hide
          Radim Kubacki added a comment -

          Same problem: set of project at work using central through local Nexus and another set of project mirroring through another repository.

          Show
          Radim Kubacki added a comment - Same problem: set of project at work using central through local Nexus and another set of project mirroring through another repository.
          Hide
          dmas added a comment -

          Need the same to have home and work enviroments operative.

          Show
          dmas added a comment - Need the same to have home and work enviroments operative.
          Hide
          Oliver B. Fischer added a comment -

          Same problem here.

          Show
          Oliver B. Fischer added a comment - Same problem here.
          Hide
          Christian Lipphardt (camunda) added a comment -

          I would really appreciate if this would be possible.
          The usecase is working in the office with a mirror (eg. inhouse) and working somewhere else using another mirror (datacenter).

          Show
          Christian Lipphardt (camunda) added a comment - I would really appreciate if this would be possible. The usecase is working in the office with a mirror (eg. inhouse) and working somewhere else using another mirror (datacenter).
          Hide
          Edoardo Causarano added a comment -

          Definitely an improvement that would make great sense as well as adding proxies (as also mentioned in a previous comment.)

          Show
          Edoardo Causarano added a comment - Definitely an improvement that would make great sense as well as adding proxies (as also mentioned in a previous comment.)
          Hide
          Ashish Singh added a comment -

          If mirrors comes under profiles.
          In that case adding a profile of mirrors with every mvn command, is some what pointing to two different settings.xml using --settings option.

          For example:

          inhouse

          mvn install -P inhouse   
          or mvn install -s ${HOME}/settings-inhouse.xml
          

          datacenter:

          mvn install -P datacenter   
          or mvn install -s ${HOME}/settings-datacenter.xml
          

          looks like to be be same amount of changes.

          Show
          Ashish Singh added a comment - If mirrors comes under profiles. In that case adding a profile of mirrors with every mvn command, is some what pointing to two different settings.xml using --settings option. For example: inhouse mvn install -P inhouse or mvn install -s ${HOME}/settings-inhouse.xml datacenter: mvn install -P datacenter or mvn install -s ${HOME}/settings-datacenter.xml looks like to be be same amount of changes.
          Hide
          Martin W. Kirst added a comment -

          This is a patch solving this issue.
          I've also added more tests.

          The only thing I don't understand is why there are two classes taking
          care of creating the internal settings model.
          What are the responsibilities of
          DefaultMavenExecutionRequestPopulator vs.
          SettingsXmlConfigurationProcessor ?

          Feedback is highly welcome.

          Show
          Martin W. Kirst added a comment - This is a patch solving this issue. I've also added more tests. The only thing I don't understand is why there are two classes taking care of creating the internal settings model. What are the responsibilities of DefaultMavenExecutionRequestPopulator vs. SettingsXmlConfigurationProcessor ? Feedback is highly welcome.
          Hide
          ASF GitHub Bot added a comment -

          GitHub user nitram509 opened a pull request:

          https://github.com/apache/maven/pull/71

          MNG-3525-maven-settings - settings.xml allowing mirror definitions inside profiles

          This improves user settings to have a mirrors list switched on/off via Maven profile.
          See commit messages for details.

          Direct issue link: https://issues.apache.org/jira/browse/MNG-3525

          Any feedback is welcome.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/nitram509/maven MNG-3525

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/maven/pull/71.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #71


          commit b097c46c9c7e26fde4f07a459d27828e59589e6b
          Author: nitram509 <maki@bitkings.de>
          Date: 2015-11-01T11:49:56Z

          MNG-3525 extended the settings model, that i can have mirrors within a profile

          commit d2d85b5d6f4ba473fc0ed27ef7f2e37ac94a20d2
          Author: nitram509 <maki@bitkings.de>
          Date: 2015-11-01T12:01:30Z

          MNG-3525 introducing CommandLineSettings to address the challenge to handle command line parameters have highest priority, compared to user settings and global settings

          commit c446764506e3101ddc4e9984c8cf624fce8e2462
          Author: nitram509 <maki@bitkings.de>
          Date: 2015-11-01T12:04:59Z

          MNG-3525 mirrors settings from active profiles are taken into account for MavenExecutionRequest - Part#1 DefaultMavenExecutionRequestPopulator

          commit 844314af17800a43f52f741a7878e9e371423964
          Author: nitram509 <maki@bitkings.de>
          Date: 2015-11-01T12:08:44Z

          MNG-3525 refactored duplicate logic for file resolving into separate class

          commit 29c4e9202db8d1e59e8afa9bb0748505e019ac37
          Author: nitram509 <maki@bitkings.de>
          Date: 2015-11-01T12:17:13Z

          MNG-3525 mirrors settings from active profiles are taken into account - Part#2 SettingsXmlConfigurationProcessor
          the refactoring of ActiveProfileArgumentParser was necessary, because when doing xml processing, active profiles need to be known, to select the right profile, which may contains mirror information


          Show
          ASF GitHub Bot added a comment - GitHub user nitram509 opened a pull request: https://github.com/apache/maven/pull/71 MNG-3525 -maven-settings - settings.xml allowing mirror definitions inside profiles This improves user settings to have a mirrors list switched on/off via Maven profile. See commit messages for details. Direct issue link: https://issues.apache.org/jira/browse/MNG-3525 Any feedback is welcome. You can merge this pull request into a Git repository by running: $ git pull https://github.com/nitram509/maven MNG-3525 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven/pull/71.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #71 commit b097c46c9c7e26fde4f07a459d27828e59589e6b Author: nitram509 <maki@bitkings.de> Date: 2015-11-01T11:49:56Z MNG-3525 extended the settings model, that i can have mirrors within a profile commit d2d85b5d6f4ba473fc0ed27ef7f2e37ac94a20d2 Author: nitram509 <maki@bitkings.de> Date: 2015-11-01T12:01:30Z MNG-3525 introducing CommandLineSettings to address the challenge to handle command line parameters have highest priority, compared to user settings and global settings commit c446764506e3101ddc4e9984c8cf624fce8e2462 Author: nitram509 <maki@bitkings.de> Date: 2015-11-01T12:04:59Z MNG-3525 mirrors settings from active profiles are taken into account for MavenExecutionRequest - Part#1 DefaultMavenExecutionRequestPopulator commit 844314af17800a43f52f741a7878e9e371423964 Author: nitram509 <maki@bitkings.de> Date: 2015-11-01T12:08:44Z MNG-3525 refactored duplicate logic for file resolving into separate class commit 29c4e9202db8d1e59e8afa9bb0748505e019ac37 Author: nitram509 <maki@bitkings.de> Date: 2015-11-01T12:17:13Z MNG-3525 mirrors settings from active profiles are taken into account - Part#2 SettingsXmlConfigurationProcessor the refactoring of ActiveProfileArgumentParser was necessary, because when doing xml processing, active profiles need to be known, to select the right profile, which may contains mirror information
          Hide
          Martin W. Kirst added a comment -

          Deleted the attachment in favor of using the Github pull request:
          https://github.com/apache/maven/pull/71

          Show
          Martin W. Kirst added a comment - Deleted the attachment in favor of using the Github pull request: https://github.com/apache/maven/pull/71
          Hide
          ASF GitHub Bot added a comment -

          Github user jvanzyl commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-152828665

          Looking through the changes, definitely useful. Just a suggestion for your for your Git commit messages: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

          Show
          ASF GitHub Bot added a comment - Github user jvanzyl commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-152828665 Looking through the changes, definitely useful. Just a suggestion for your for your Git commit messages: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
          Hide
          ASF GitHub Bot added a comment -

          Github user nitram509 commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-152829442

          Thank you for this fast feedback.

          Show
          ASF GitHub Bot added a comment - Github user nitram509 commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-152829442 Thank you for this fast feedback.
          Hide
          ASF GitHub Bot added a comment -

          Github user nitram509 commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-156813724

          I've just rebased the latest commits from master.

          Show
          ASF GitHub Bot added a comment - Github user nitram509 commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-156813724 I've just rebased the latest commits from master.
          Hide
          Roy Teeuwen added a comment -

          Nop it is totally different, seeing as the -P will be passed to spawned off maven threads (when building archetypes, or in tests or wherever) while the -s will not

          Show
          Roy Teeuwen added a comment - Nop it is totally different, seeing as the -P will be passed to spawned off maven threads (when building archetypes, or in tests or wherever) while the -s will not
          Hide
          ASF GitHub Bot added a comment -

          Github user nitram509 commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-163789774

          Is there anything I miss, that this PR can be merged?
          Or is there a plan/roadmap when merge could happen?

          Show
          ASF GitHub Bot added a comment - Github user nitram509 commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-163789774 Is there anything I miss, that this PR can be merged? Or is there a plan/roadmap when merge could happen?
          Hide
          ASF GitHub Bot added a comment -

          Github user jvanzyl commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-163790796

          I suggested the link on how to make comments so you would adjust them. Nothing is easy to read with the way they currently are. For example, I'm not sure why you introduced the CommandLineSettings and didn't use the existing classes.

          Show
          ASF GitHub Bot added a comment - Github user jvanzyl commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-163790796 I suggested the link on how to make comments so you would adjust them. Nothing is easy to read with the way they currently are. For example, I'm not sure why you introduced the CommandLineSettings and didn't use the existing classes.
          Hide
          ASF GitHub Bot added a comment -

          Github user jvanzyl commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-163810810

          If you're around tomorrow I can spare an hour if you want to work together in a hangout to try and get this merged. It's a good feature, I just have some questions and we might need a small refactor.

          Show
          ASF GitHub Bot added a comment - Github user jvanzyl commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-163810810 If you're around tomorrow I can spare an hour if you want to work together in a hangout to try and get this merged. It's a good feature, I just have some questions and we might need a small refactor.
          Hide
          ASF GitHub Bot added a comment -

          Github user nitram509 commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-163871636

          Sure.
          Btw.my timezone is UTC+1

          Show
          ASF GitHub Bot added a comment - Github user nitram509 commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-163871636 Sure. Btw.my timezone is UTC+1
          Hide
          ASF GitHub Bot added a comment -

          Github user michael-o commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-163879891

          @jvanzyl Without looking deeply into this, it looks like a massive commit with a model change. This should be in 3.4 or later.

          @nitram509 You have refomatted some code to Maven guidelines which I appreciate but they are unrelated to this PR. Please create a separete PR for these kinds of improvements. PS: UTC+1 isn't a timezone, it's an offset. `Europe/Berlin` is

          Show
          ASF GitHub Bot added a comment - Github user michael-o commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-163879891 @jvanzyl Without looking deeply into this, it looks like a massive commit with a model change. This should be in 3.4 or later. @nitram509 You have refomatted some code to Maven guidelines which I appreciate but they are unrelated to this PR. Please create a separete PR for these kinds of improvements. PS: UTC+1 isn't a timezone, it's an offset. `Europe/Berlin` is
          Hide
          ASF GitHub Bot added a comment -

          Github user jvanzyl commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-163962240

          @michael-o the model change will be all right provided the reader ignores fields it doesn't understand. So newer versions that understand the change can deal with it accordingly. Older versions will just ignore them. If this is not the case then I agree. I have not intention of breaking users with the change but not very concerned which version it goes into. We don't really follow anything reasonable yet insofar as how we change our versions with respect to features or apis or both together.

          Show
          ASF GitHub Bot added a comment - Github user jvanzyl commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-163962240 @michael-o the model change will be all right provided the reader ignores fields it doesn't understand. So newer versions that understand the change can deal with it accordingly. Older versions will just ignore them. If this is not the case then I agree. I have not intention of breaking users with the change but not very concerned which version it goes into. We don't really follow anything reasonable yet insofar as how we change our versions with respect to features or apis or both together.
          Hide
          ASF GitHub Bot added a comment -

          Github user jvanzyl commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-163965483

          @nitram509 while i'm in California meeting up is a bit tough, but I will be back in Toronto tomorrow and then I'll email you and we'll figure out a time.

          Show
          ASF GitHub Bot added a comment - Github user jvanzyl commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-163965483 @nitram509 while i'm in California meeting up is a bit tough, but I will be back in Toronto tomorrow and then I'll email you and we'll figure out a time.
          Hide
          ASF GitHub Bot added a comment -

          Github user nitram509 commented on the pull request:

          https://github.com/apache/maven/pull/71#issuecomment-164198985

          @jvanzyl For me it's to late now, let's talk tomorrow.

          Show
          ASF GitHub Bot added a comment - Github user nitram509 commented on the pull request: https://github.com/apache/maven/pull/71#issuecomment-164198985 @jvanzyl For me it's to late now, let's talk tomorrow.

            People

            • Assignee:
              Unassigned
              Reporter:
              Paul Gribben
            • Votes:
              34 Vote for this issue
              Watchers:
              29 Start watching this issue

              Dates

              • Created:
                Updated:

                Development