无法手动将 jar 文件添加到 .ivy 缓存 [英] Unable to add jar file to .ivy cache manually

查看:18
本文介绍了无法手动将 jar 文件添加到 .ivy 缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试手动将 lucene jar 文件添加到我的本地 ivy 存储库.我有其他 apache jar,所以在现有文件夹 .ivy2cacheapache.org 下,我创建了一个名为 lucene 的文件夹,并在其中创建了一个名为 jars 的文件夹.然后我将名为 lucene-3.0.3.jar 的 jar 放在 jars 文件夹中.下一步我在 lucene 文件夹中创建了以下 ivy-3.0.3.xml:

I am trying to manually add lucene jar file to my local ivy repository. I have other apache jars so under the existing folder .ivy2cacheapache.org I've created a folder called lucene and inside it a folder called jars. I then placed the jar named lucene-3.0.3.jar in the jars folder. Next step I've created the following ivy-3.0.3.xml in the lucene folder:

<?xml version="1.0" encoding="UTF-8"?>

<ivy-module version="1.0">
    <info organisation="apache.org" module="lucene" revision="3.0.3" status="release" publication="20090416105712">
   </info>
   <publications>
      <artifact name="lucene-3.0.3" type="jar" ext="jar"/>
   </publications>
</ivy-module>

然后我尝试从这样的项目中引用它:

I then try to reference it from a project like that:

<dependency org="apache.org" name="lucene" rev="3.0.3"/>

但我收到一个错误:未解决的依赖项:apache.org#lucene;3.0.3: not found"

But I get an error: "unresolved dependency: apache.org#lucene;3.0.3: not found"

我可以从我的 .ivy2 缓存文件夹中找到其他依赖项,只是我手动创建的这个有问题.

I am able to find other dependencies from my .ivy2 cache folders, just this one that I've created manually is giving problems.

我错过了什么?

推荐答案

我同意 Mark,您应该将文件放在本地存储库而不是缓存中.特别是因为期望缓存可以(并且经常)随时被删除.

I agree with Mark, you should put the file in your local repository instead of your cache. Especially since the expectation is that the cache could be (and often is) deleted at any time.

但是,为了解决您的问题,您的错误最可能的原因是您的文件夹层次结构与预期的模式不匹配.默认情况下,缓存的布局如下:

However, to address your question, the most likely reason for your error is that your folder hierarchy does not match the expected pattern. By default, the cache is laid out as follows:

[organisation]/[module]/[revision]/[type]s/[artifact].[ext]

因此,您必须将文件移动到以下目录以消除该错误:

So you'd have to move your file to the following directory to eliminate that error:

.ivy2cacheapache.orglucene3.0.3jarslucene.jar

有时,默认模式会根据设置文件更改,因此确定预期模式的唯一方法是查看缓存中的其他 jar(例如,现在,我的缓存有 [revision] 部分文件名的结尾,否则,其他都一样).

Sometimes, the default pattern gets changed based on settings files so the only way to be certain of the expected pattern is to look at other jars in your cache (for example, right now, my cache has the [revision] portion at the end of the file name, otherwise, all else is the same).

不过,我同意 Mark 的观点,您确实不想手动将内容添加到缓存中.相反,将它们添加到默认本地存储库或者更好的是,创建您自己的基本存储库.

However, I agree with Mark though, you really don't want to manually add things to the cache. Instead, add them to the default local repository OR better yet, create your own basic repository.

这篇关于无法手动将 jar 文件添加到 .ivy 缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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