Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
733 views
in Technique[技术] by (71.8m points)

dependencies - Unable to add jar file to .ivy cache manually

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"/>

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...