JHipster配置Maven包装代理 [英] JHipster configure maven wrapper proxy

查看:301
本文介绍了JHipster配置Maven包装代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 https://jhipster.github.io/configuring-a-corporate -proxy/我已经在/.m2/settings.xml中设置了代理设置,如下所示:

According to https://jhipster.github.io/configuring-a-corporate-proxy/ I have set up my proxy settings in /.m2/settings.xml like this :

  <proxies>
    <proxy>
      <id>myId</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>myDomain\myUsername</username>
      <password>myPassword</password>
      <host>myHost</host>
      <port>myPort</port>
    </proxy>
  </proxies>

但是当我尝试mvnw该项目时,它以某种方式不起作用,它给了我:

But somehow it is not working when I'm trying to mvnw the project, it's giving me :

Exception in thread "main" java.net.ConnectException: Connection refused: connect

在将以下参数传递给MAVEN_OPTS时,我设法使其正常工作,但我只想使用settings.xml文件.

I managed to get it work while passing below parameters to MAVEN_OPTS but I would like to do so with settings.xml file only.

set MAVEN_OPTS=-Dhttps.proxyHost=myHost -Dhttps.proxyPort=myPort -Dhttps.proxyUser=myDomain\myUsername -Dhttps.proxyPassword=myPassword

任何人都可以帮忙吗?

谢谢.

推荐答案

似乎Maven Wrapper没有使用Maven设置中的代理变量. 下载器不配置任何代理,因此这意味着必须使用Java系统属性.对于身份验证,它只查找系统属性http.proxyUser

It seems Maven Wrapper does not use the proxy variables from Maven settings. The Downloader does not configure any proxy, so this means Java system properties must be used. For authentication, it just looks for the system property http.proxyUser and uses it.

设置MAVEN_OPTS(如您所提到的,以及此处 )的作品:

Setting the MAVEN_OPTS (as you mentioned and also here) works:

set MAVEN_OPTS=-Dhttp.proxyHost=proxyhost -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxyhost -Dhttps.proxyPort=8080

export MAVEN_OPTS=-Dhttp.proxyHost=proxyhost -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxyhost -Dhttps.proxyPort=8080

mvnw脚本还从项目路径中提取文件.mvn/jvm.config,该文件可以包含以下属性:

The mvnw script also pulls in a file .mvn/jvm.config from the project path which can include these properties:

-Dhttp.proxyHost=host 
-Dhttp.proxyPort=port 
-Dhttps.proxyHost=host 
-Dhttps.proxyPort=port 
-Dhttp.proxyUser=username 
-Dhttp.proxyPassword=password

我已经开放一个拉取请求(#446 )将此信息添加到JHipster文档中.

I've openend a pull request (#446) to add this info to the JHipster documentation.

这篇关于JHipster配置Maven包装代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆