簡體   English   中英

JHipster 配置 Maven 包裝代理

[英]JHipster configure maven wrapper proxy

根據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>

但是不知何故,當我嘗試 mvnw 項目時它不起作用,它給了我:

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

我在將以下參數傳遞給 MAVEN_OPTS 時設法讓它工作,但我只想使用 settings.xml 文件這樣做。

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

任何人都可以幫忙嗎?

提前致謝。

Maven Wrapper 似乎不使用 Maven 設置中的代理變量。 下載器不配置任何代理,因此這意味着必須使用 Java 系統屬性。 對於身份驗證,它只查找系統屬性http.proxyUser使用它

設置 MAVEN_OPTS(如您所提到的和這里的)有效:

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 ,其中可以包含以下屬性:

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

我打開了一個拉取請求 ( #446 ) 將此信息添加到 JHipster 文檔中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM