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

查看:25
本文介绍了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>myDomainmyUsername</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=myDomainmyUsername -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 opened a pull request (#446) to add this info to the JHipster documentation.

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

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