简体   繁体   English

Maven编译TimeOut错误

[英]Maven compilation TimeOut error

I need to compile with a prod maven profile, so I execute the command: 我需要使用prod maven配置文件进行编译,因此我执行命令:

mvnw package -Pprod  -Dmaven.test.skip=true

But it gives me a Connection TimeOut error: 但它给了我一个Connection TimeOut错误:

C:\Users\UserX\Desktop\Workspace\mecenz>mvnw package -Pprod  -Dmaven.test.skip=tru
Downloading https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip

Exception in thread "main" java.net.ConnectException: Connection timed out: connect
        at java.net.DualStackPlainSocketImpl.connect0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
        at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
        at org.apache.maven.wrapper.DefaultDownloader.downloadInternal(DefaultDownloader.java:73)
        at org.apache.maven.wrapper.DefaultDownloader.download(DefaultDownloader.java:60)
        at org.apache.maven.wrapper.Installer.createDist(Installer.java:64)
        at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:121)
        at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)

Here I have configured the proxy as it should be in the settings.xml of maven: 这里我已经配置了代理,因为它应该在maven的settings.xml中:

<proxies>
<proxy>    
  <id>the_id</id>
  <active>true</active>
  <protocol>http</protocol>
    <!--  <username>proxyuser</username>
    <password>proxypass</password>-->
  <host>my proxy adresse</host>
  <port>8080</port>
  <nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>

I really don't know what should I do more! 我真的不知道我该怎么做!

I have changed this URL in maven-wrraper.properties into: https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip and yet gives me the same error. 我已将maven-wrraper.properties URL maven-wrraper.properties为: httpsmaven-wrraper.properties .zip然而却给了我同样的错误。

How would you troubleshoot this? 你怎么解决这个问题?

You could simply set your HTTP_PROXY / HTTPS_PROXY environment variables to the same value as the one set in your settings.xml, and download maven yourself, without having to rely on an mvnw maven wrapper (presented in this article ) 您可以简单地将HTTP_PROXY / HTTPS_PROXY环境变量设置为与settings.xml中设置的相同的值,并自己下载maven,而不必依赖于mvnw maven包装器在本文中介绍

Simply fo to the Downloading Apache Maven 3.5.0 page, and get the Binary zip archive that you can uncompress anywhere you want. 只需下载Apache Maven 3.5.0页面,即可获得可以在任何地方解压缩的Binary zip存档。 Add that folder to your PATH and you are set to use a regular mvn command. 将该文件夹添加到PATH,并设置为使用常规mvn命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM