Failed to add jar file to .ivy cache manually

I am trying to manually add the lucene jar file to my local ivy repository. I have other apache banks, so in the existing folder .ivy2 \ cache \ apache.org \ I created a folder called lucene and inside it is a folder called jars. Then I placed a jar named lucene-3.0.3.jar in the jars folder. In the next step, I created the following ivy-3.0.3.xml file 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> 

Then I will try to reference it from such a project:

 <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 can find other dependencies from my .ivy2 cache folders, only the one I created manually creates problems.

Anything I missed?

+6
dependencies ivy
source share
2 answers

I agree with Mark, you should put the file in your local repository instead of your cache. Moreover, it is expected that the cache can (and often) be deleted at any time.

However, to solve your question, the most likely cause of your error is that the folder hierarchy does not match the expected template. By default, the cache is laid out as follows:

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

Therefore, you need to move the file to the following directory to resolve this error:

 .ivy2\cache\apache.org\lucene\3.0.3\jars\lucene.jar 

Sometimes the default template is changed based on the settings files, so the only way to verify the expected template is to look at other banks in your cache (for example, right now my cache has a [revision] part at the end of the file name, otherwise everything else will be the same) .

However, I agree with Mark, but you really do not want to manually add things to the cache. Instead, add them to your local default repository, or better yet, create your own main repository .

+2
source share

The ivy cache is not a repository, but a cache (other than Maven). The cache contains metadata files that record which ivy was previously downloaded.

I suggest you place the files in the local location of the ivy repository, which is stored (by default) along with the cache:

 $HOME/.ivy2/local 

So, in your example, you need to store the jar here:

 $HOME/.ivy2/local/org.apache/lucene/3.0.3/jars/lucene.jar 
+1
source share

All Articles