简体   繁体   English

Eclipse中的Maven依赖

[英]Maven dependency in eclipse

I am trying to use jersey API and this is my first maven project. 我正在尝试使用Jersey API,这是我的第一个Maven项目。

I have 2 maven dependency problems that look like this: 我有两个看起来像这样的Maven依赖问题:

Description Resource    Path    Location    Type
ArtifactTransferException: Failure to transfer org.glassfish.hk2:osgi-resource-locator:jar:1.0.1 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.glassfish.hk2:osgi-resource-locator:jar:1.0.1 from/to central (http://repo.maven.apache.org/maven2)

Description Resource    Path    Location    Type
Missing artifact org.glassfish.hk2:osgi-resource-locator:jar:1.0.1  

How should I go about to fix this? 我应该如何解决这个问题?

Remove all your failed downloads from 从中删除所有失败的下载

For windows: 对于Windows:

cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i

Then rightclick on your project in eclipse and choose Maven->Update Dependencies 然后右键单击Eclipse中的项目,然后选择Maven-> Update Dependencies

Possible solutions 可能的解决方案

  1. Delete your repo in home folder then build with force Update Snapshot option 删除主文件夹中的仓库,然后使用强制更新快照选项进行构建
  2. Copy paste link in error trace into your browser if didnt work you have to create settings.xml file in your repo home folder and set proxy if you are using them 如果无法正常工作,则将错误跟踪中的粘贴链接复制到浏览器中,如果无法使用,则必须在回购主文件夹中创建settings.xml文件,并在使用代理时设置代理

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

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