JHipster配置maven包装器代理

Fab*_*sel 11 https proxy maven jhipster

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

  <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>
Run Code Online (Sandbox Code Playgroud)

但不知何故,当我试图修改这个项目时它不起作用,它给了我:

Exception in thread "main" java.net.ConnectException: Connection refused: connect
Run Code Online (Sandbox Code Playgroud)

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

set MAVEN_OPTS=-Dhttps.proxyHost=myHost -Dhttps.proxyPort=myPort -Dhttps.proxyUser=myDomain\myUsername -Dhttps.proxyPassword=myPassword
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

提前致谢.

Son*_*ata 21

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

设置MAVEN_OPTS(如你所提到的,也在这里)有效:

set MAVEN_OPTS=-Dhttp.proxyHost=proxyhost -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxyhost -Dhttps.proxyPort=8080
Run Code Online (Sandbox Code Playgroud)

要么

export MAVEN_OPTS=-Dhttp.proxyHost=proxyhost -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxyhost -Dhttps.proxyPort=8080
Run Code Online (Sandbox Code Playgroud)

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

-Dhttp.proxyHost=host 
-Dhttp.proxyPort=port 
-Dhttps.proxyHost=host 
-Dhttps.proxyPort=port 
-Dhttp.proxyUser=username 
-Dhttp.proxyPassword=password
Run Code Online (Sandbox Code Playgroud)

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

  • 该值需要引用,应该是 **export MAVEN_OPTS="-Dhttp.proxyHost=proxyhost -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxyhost -Dhttps.proxyPort=8080"** (4认同)
  • 太感谢了!jvm.config 文件为我解决了这个问题。 (2认同)