Java Maven错误-传输失败
我正在研究网络上的一些spring示例。我从中得到了一个例子 在eclipse中导入项目时,POM.xml文件中出现错误Java Maven错误-传输失败,java,eclipse,maven,Java,Eclipse,Maven,我正在研究网络上的一些spring示例。我从中得到了一个例子 在eclipse中导入项目时,POM.xml文件中出现错误 Multiple annotations found at this line: - Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from http://repo.maven.apache.org/maven2 was cached in the local re
Multiple annotations found at this line:
- Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from http://repo.maven.apache.org/maven2 was cached in the
local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer
artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): null to http://
repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom
- connection timed out
- Failure to transfer org.apache.maven.plugins:maven-source-plugin:pom:2.0.4 from http://repo.maven.apache.org/maven2 was cached in the
local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer
artifact org.apache.maven.plugins:maven-source-plugin:pom:2.0.4 from/to central (http://repo.maven.apache.org/maven2): connection timed out to
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-source-plugin/2.0.4/maven-source-plugin-2.0.4.pom
我还尝试删除我的.m2\repository文件夹。但还是会出错
有谁能指导我解决这个问题吗?您收到一个请求存储库的超时异常。有时工作不正常。还可能存在其他网络问题,如主机dns、网络断开的集线器、网络代理设置等。此问题主要是因为防火墙更好地使用代理。
在
settings.xml
(.m2\repository\settings.xml)中,添加相应的proxy
设置,告诉Maven通过代理下载工件
<settings>
.......
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>your_proxy_host</host>
<port>your_proxy_port</port>
<!-- Its optional if you need user name and password to connect proxy remove comment.
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>*.yourdomain.com|*.yourOtherDomain.com</nonProxyHosts>
-->
</proxy>
</proxies>
</settings>
.......
真的
http
您的\u代理\u主机
您的\u代理\u端口
是的,我自己也遇到过这个问题。以下是一些其他观察结果:
我们不知道的东西可能会严重伤害我们——举个例子——(eclipse+代理)动力学。通过大量的谷歌搜索找到了解决方案:除了在settings.xml中添加代理信息外,我还必须添加以下内容以解决问题。同样,只有当涉及代理时,这才是一个问题。这是下一次与日食相关的神秘堆栈跟踪呕吐之前的平静——我猜
<activeProfiles>
<activeProfile>securecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>securecentral</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
安全中心
安全中心
中心的
https://repo1.maven.org/maven2
真的
中心的
https://repo1.maven.org/maven2
真的
我在许多不同的网络中遇到了相同的问题,这通常不会发生,因为您的互联网或网络,这就是Maven repo的问题,作为解决方案,我清理了本地.m repo目录,并通过Maven/更新Maven依赖项再次下载jar文件。
这个问题将不复存在。这只是一次过程,不需要每次都这样做。为maven提供settings.xml文件,其中包含连接到存储库的用户ID和密码信息。settings.xml文件包含如下信息-
<repository>
<id>your_nexus_repo_id</id>
<url>https://path_to_nexus_repo_location</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<server>
<id>dsnexus1</id>
<username>your_user_id</username>
<password>your_password</password>
</server>
您的\u nexus\u repo\u id
https://path_to_nexus_repo_location
真的
真的
dsnexus1
您的\u用户\u id
你的密码
您可以在Eclipse中提供settings.xml文件,如下所示-
<repository>
<id>your_nexus_repo_id</id>
<url>https://path_to_nexus_repo_location</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<server>
<id>dsnexus1</id>
<username>your_user_id</username>
<password>your_password</password>
</server>