1

Ignoring why I would want to do this -- there are valid reasons in my case -- which I don't want to get into.

Is there a way to configure Maven Proxy settings (specifically add a Proxy for dependencies) at the app level (i.e. committed in SCM as part of my Java application , in say something like my pom.xml) ... instead of the more traditional global settings.xml location.

In my case, I would somehow want to include the following settings.xml changes as part of my Java application source code without requiring any changes to global / user level settings.

<proxy> 
      <id>optional</id> 
      <active>true</active> 
      <protocol>http</protocol> 
      <host>someotherhost.com</host> 
      <port>8080</port> 
      <nonProxyHosts></nonProxyHosts> 
 </proxy> 
vicsz
  • 9,552
  • 16
  • 69
  • 101

2 Answers2

0

Using maven profile might help. You may want to look into this SO answer, could be helpful for your situation.

  • Thanks though this still seems to require editing of the Global settings.xml file ... which I don't want to touch, ideally I want the profile settings as part of my java app (in it's individual SCM repo in some way -- pom.xml settings maybe ?). – vicsz Jan 14 '21 at 15:00
0

You can add your own settings.xml to the project. Then you can use it in your build server with the -s parameter.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • Fixes the build server problem -- but I would also want let developers to get this functionality locally without running maven with the parameter and without any required global config changes. – vicsz Jan 14 '21 at 19:30
  • I don't think that is possible. You haven't described the reasons behind your question. Knowing the whole situation, one might find a better solution. – J Fabian Meier Jan 15 '21 at 09:25