无法将jar文件手动添加到.ivy缓存 [英] Unable to add jar file to .ivy cache manually
问题描述
我正在尝试手动添加lucene jar文件到我的本地ivy仓库。
我有其他apache jar,所以在现有的文件夹下.ivy2\cache\apache.org\我创建了一个名为lucene的文件夹,里面有一个名为jars的文件夹。然后我将名为lucene-3.0.3.jar的jar放在jars文件夹中。
下一步我在lucene文件夹中创建了以下ivy-3.0.3.xml:
?xml version =1.0encoding =UTF-8?>
< ivy-module version =1.0>
< info organization =apache.orgmodule =lucenerevision =3.0.3status =releasepublication =20090416105712>
< / info>
< publications>
< artifact name =lucene-3.0.3type =jarext =jar/>
< / publications>
< / ivy-module>
然后我尝试从这样的项目中引用它:
< dependency org =apache.orgname =lucenerev =3.0.3/>
但是我收到一个错误:未解决的依赖关系:apache.org#lucene; 3.0.3:not发现
我可以从我的.ivy2缓存文件夹中找到其他依赖项,只是我手动创建的一个提供问题。
我错过了什么?
我同意Mark,你应该把文件放在您的本地存储库而不是缓存。特别是因为期望缓存可以(并经常被删除)在任何时候。
但是,为了解决你的问题,你的错误的最可能的原因是您的文件夹层次结构与预期模式不匹配。默认情况下,缓存的布局如下:
[组织] / [模块] / [修订] / [类型] s / [artifact]。[ext]
所以你必须将你的文件移动到以下目录以消除该错误:
.ivy2\cache\apache.org\lucene\3.0.3\ jars\lucene.jar
有时,默认模式会根据设置文件进行更改,因此只有这样要确定预期的模式是查看缓存中的其他jar(例如,现在,我的缓存在文件名末尾有[revision]部分,否则所有其他的都相同)。 p>
但是,我同意Mark虽然,你实际上不想手动将东西添加到缓存。相反,将它们添加到默认的本地存储库或更好的是,创建自己的基本存储库。
I am trying to manually add lucene jar file to my local ivy repository. I have other apache jars so under the existing folder .ivy2\cache\apache.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"/>
But I get an error: "unresolved dependency: apache.org#lucene;3.0.3: not found"
I am able to find other dependencies from my .ivy2 cache folders, just this one that I've created manually is giving problems.
Anything I have missed?
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:
.ivy2\cache\apache.org\lucene\3.0.3\jars\lucene.jar
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).
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屋!