Maven连接重置错误

wh6knrhe  于 2022-11-02  发布在  Maven
关注(0)|答案(4)|浏览(307)

我有一个Linux上的maven项目。直到上周它还构建得很好。今天我得到了下面的错误

[ERROR] Failed to execute goal on project my-integration-service: Could not resolve
dependencies for project com.mycompany.myproj:my-integration-service:jar:0.0.1-SNAPSHOT:
Failed to collect dependencies for [org.springframework:spring-core:jar:4.0.4.RELEASE
(compile), org.springframework:spring-tx:jar:4.0.4.RELEASE (compile), ...]: No versions
available for joda-time:joda-time:jar:[2.2,) within specified range -> [Help 1]

我检查了我的settings.xml,在本地存储库中,我可以看到这个库的许多版本... 2.2、2.4... 2.9.1
我还看到了文件M2_REPO/joda-time/joda-time/resolver-status.properties

maven-metadata-codehaus.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to codehaus (http\://repository.codehaus.org/org/codehaus)\: Error transferring file\: repository.codehaus.org
...
maven-metadata-spring-milestone.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to spring-milestone (http\://maven.springframework.org/milestone)\: Error transferring file\: Connection reset
....
maven-metadata-com.springsource.repository.maven.releases.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to com.springsource.repository.maven.releases (http\://maven.springframework.org/release)\: Error transferring file\: Connection reset
...
maven-metadata-just-testing.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to just-testing (http\://repo1.maven.org/maven2)\: Access denied to\: http\://repo1.maven.org/maven2/joda-time/joda-time/maven-metadata.xml
...
maven-metadata-apache.snapshots.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to apache.snapshots (http\://repository.apache.org/snapshots/)\: Error transferring file\: Connection reset
...
maven-metadata-maven-restlet.xml.error=Could not transfer metadata joda-time\:joda-time/maven-metadata.xml from/to maven-restlet (http\://maven.restlet.org)\: Error transferring file\: Connection reset

我还运行了命令mvn -X archetype:按照建议生成What could be causing 'error transferring file' in maven?

[WARNING] Error reading archetype catalog http://repo1.maven.org/maven2
org.apache.maven.wagon.TransferFailedException: Error transferring file: Connection reset
        at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:143)
        at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
        at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
        ....
        ....
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:196)
        at java.net.SocketInputStream.read(SocketInputStream.java:122)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
        at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
        at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:658)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1323)
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
        at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
        ... 31 more
[WARNING] No archetype found in remote catalog. Defaulting to internal catalog
[DEBUG] Using catalog /wmchome/hfundadm/.m2/archetype-catalog.xml
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype

不太确定是什么原因导致此错误?
1.是否有端口被阻塞?如果有,为什么只有1个文件出错?
1.不确定是否忽略了local_repository?此处有需要的文件
1.清单项目
使用Apache Maven 3.0.3(r1075438; 2011年02月28日12时31分09秒05分)

<profile>
      <id>defaultProfile</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>central</id>
          <url>http://my-mvn-repo/repo</url>
            <snapshots>
              <enabled>true</enabled>
              <updatePolicy>always</updatePolicy>
            </snapshots>
            <releases>
              <enabled>true</enabled>
            </releases>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://my-mvn-repo/repo</url>
            <releases>
              <enabled>true</enabled>
            </releases>
        </pluginRepository>
      </pluginRepositories>
      <properties>
        <downloadSources>true</downloadSources>
        <downloadJavadocs>true</downloadJavadocs>
      </properties>
</profile>

但我没有看到任何以<id>为中心的服务器,有许多服务器...不确定正在使用哪一个

<server>
        <id>abccommon_id</id> 
        <username>abccommon_adm</username>
        <password>****</password>
</server>
iugsix8n

iugsix8n1#

我使用了以下标志,它成功地下载了所有内容。

-Dhttps.protocols=TLSv1.2
eqqqjvef

eqqqjvef2#

I had proxy issue

更新版本:

sample:

<proxies>
   <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.example.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>
68bkxrlz

68bkxrlz3#

您没有访问存储库的权限。

Access denied to\: http\://repo1.maven.org/maven2/joda-time/joda-time/maven-metadata.xml

...
这里最可能的问题是您的认证。您可能没有正确提供认证。

zkure5ic

zkure5ic4#

我也有一个代理问题,我已经设置了一个代理。我得到了连接重置错误。这个错误出现在试图访问我的网络上的资源。
我不得不添加一个类似Bharath提供的nonProxyHosts行,这样就解决了错误。

相关问题