通过毕业生解决依赖于代理存储库的ivy导致资源丢失 [英] Resolving ivy dependencies on a proxied repository with gradle leads to missing resources

查看:244
本文介绍了通过毕业生解决依赖于代理存储库的ivy导致资源丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个主 - 从存储库方法,以nexus pro为主,一个nexus pro为奴隶,我们的快照和版本库被配置为代理(另外使用来自sonatype nexus的smartproxy技术)。 p>

我们的项目是基于Gradle和Ivy的多项目构建。我们使用动态版本(例如1. +)来定义和解决依赖关系。



问题是,无法在代理上解析工件,正确的是beeing发布到主存储库,并且不被转发到从属(代理)存储库(例如,由于网络问题或者在发布给定工件之后可以设置从属存储库的事实)。



当我发现(参见 grad in gradle ),gradle依赖解析器使用目录列表:


如果依赖关系被声明作为动态版本(如1. +),Gradle将将其解析为存储库中最新的可用静态版本(如1.2)。对于Maven存储库,这是使用maven-metadata.xml文件完成的,而对于Ivy存储库,这是通过目录列表完成的。


不幸的是,由于该工件和目录结构不可用,解析过程失败。调用 gradle --info --refresh-dependencies result to

 执行任务':解决'(最新检查花费了0.001秒)由于:
任务没有声明任何输出。
资源丢失。 [HTTP GET:http:// proxy / nexus / content / repositories / testrepo / com / company / smpro / test / SmartproxyTest /]
:resolve FAILED
:resolve(Thread [main,5,main ])完成。收到0.668秒。

我会以为Nexus正在解析主文件上可以使用的工件列表的URL通过目录列表,但它没有。如果我把较高的URL放入浏览器,我会得到404:

  404  -  ItemNotFoundException 
请求被标记为本地 - 只有远程访问不允许从M2Repository(id = testrepo)

如果我把它称为主现在我的问题是:有任何人有任何线索,为什么这不能通过代理人在主机上解决,这通常是这样做的?



谢谢,
Fred

解决方案

Nexus代理存储库响应对远程文件的请求,填充其本地磁盘存储。只有通过代理请求的文件才存储在其磁盘缓存中。



所以通过代理列出目录的分辨率不会很好。



从路径根据您的要求,您可能会使用Nexus Professional智能代理功能。如果是这样,您可以通过在代理的智能代理选项卡中选择立即下载更新的工件来部分解决此问题。这对于尚未下载的工件将不起作用。


We have a master - slave repository approach set up with nexus pro as a master and a nexus pro as slave, where our snapshot and releases repositories are configured to be proxied (moreover using the smartproxy technology from sonatype nexus).

Our project is a multiproject build which is based upon Gradle and Ivy. We use dynamic versions (e.g. 1.+) to define and resolve dependencies.

The problem is that an artifact can't be resolved on a proxy, that has correctly beeing published to the master repository and is not beeing forwarded to the slave (proxy) repository (e.g. due to network problems or the fact that a slave repository can be set up after the publishing of the given artifact).

As I found out (see docu in gradle), the gradle dependency resolver uses directory listing:

If the dependency is declared as a dynamic version (like 1.+), Gradle will resolve this to the newest available static version (like 1.2) in the repository. For Maven repositories, this is done using the maven-metadata.xml file, while for Ivy repositories this is done by directory listing.

Unfortunately since that artifact and the directory structure is not available, the process of resolution fails. Calling gradle --info --refresh-dependencies results to

Executing task ':resolve' (up-to-date check took 0.001 secs) due to:
Task has not declared any outputs.
Resource missing. [HTTP GET:     http://proxy/nexus/content/repositories/testrepo/com/company/smpro/test/SmartproxyTest/]
:resolve FAILED
:resolve (Thread[main,5,main]) completed. Took 0.668 secs.

I would have thought that the Nexus is resolving that URL on the master where the artifact list would be available through a directory listing, but it doesn't. If I put the upper URL into the browser, I get 404:

404 - ItemNotFoundException
Request is marked as local-only, remote access not allowed from M2Repository(id=testrepo)

If I call it on the master repo, it works of course.

My question now: Has anybody any clue, why this can't be resolved at the master via the proxy, which it should normally do?

Thanks, Fred

解决方案

Nexus proxy repositories populate their local disk storage in response to requests for files that are on the remote. Only the file(s) which have requested through the proxy are stored in it's disk cache.

So resolution by directory listing through a proxy isn't going to work very well.

From the path of your request it looks like you might be using the Nexus Professional smart proxy feature. If so, you can partially work around this by selecting "download updated artifacts immediately" in the "smart proxy" tab of the proxy. This won't work for artifacts which haven't already been downloaded though.

这篇关于通过毕业生解决依赖于代理存储库的ivy导致资源丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆