java - 如何让一个maven仓库不使用代理

标签 java maven

我已将 ${user.home}/.m2/settings.xml 配置为使用代理,并且其中有多个存储库。是否有可能其中一个存储库不使用代理?

settings.xml 的一部分

<settings ...>
...
    <proxies>
            <proxy>
              <id>...</id>
              <active>true</active>
              <protocol>http</protocol>
              <host>...</host>
              <port>80</port>
              <username>...</username>
              <password>...</password>
              <nonProxyHosts>...</nonProxyHosts>
            </proxy>
  </proxies>
  <profiles>
       <profile>
             <id>...</id>
             <activation>
                  <activeByDefault>true</activeByDefault>
             </activation>
             <repositories>
                  <repository>           <!-- there is more repositories like this -->
                      <id>...</id>
                      <name>...</name>
                      <url>...</url>
                      <releases>
                          <enabled>false</enabled>
                      </releases>
                      <snapshots>
                          <enabled>true</enabled>
                      </snapshots>
                  </repository>
               .....
               </repositories>
            </profile>
    </profiles>
<activeProfiles>
    <activeProfile>snapshots</activeProfile>
</activeProfiles>

最佳答案

要在访问远程存储库时绕过代理,只需将其域名或IP地址添加到 <nonProxyHosts>代理定义的标签。更多信息在Maven doc .

关于java - 如何让一个maven仓库不使用代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38179481/

相关文章:

java - Vaadin 将我的小部件集的名称加倍

java - 在 maven 项目中为 j2ee.jar 添加依赖

java - 在 pom.xml 中包含 proguard 配置文件

java - jfreechart - 更改图例中的颜色样本

netbeans - 未找到符号,但已导入库

java - line.split() 返回多少列

java - Maven 组件无法在 Windows Server 上运行

java - Spring引导无法从 cucumber 测试上下文创建数据源bean

java - 应用程序被强制关闭

java - 何时以及如何增加版本号(Maven、Java、Sonar)?