Ivy removing unwanted (older) artifacts from the Ivy cache

I have a local Artifactory repository in which I have two banks for commons-logging: one for version 1.0.4and one for version 1.1.1. I experiment using Ivy to load the old one with the ant task (with the corresponding dependency tag in ivy.xml), and then I change the "rev" attribute of this dependency tag to 1.1.1.

When using ivy: resolve in ant, this new banner successfully loads into my cache, but the older one is not deleted automatically, and I would like it to happen.

I cannot figure out how to do this after looking at the Ivy documentation; Does anyone know how to get Ivy to delete old versions of artifacts when newer ones are loaded, either with a resolution task or with something else?

+3
source share
2 answers

In fact, there is no problem with having an “older” jar in your cache. If your project does not need an old can, Ivy will simply ignore it. An old bank takes about 50 kilobytes in your system. In the era of terabyte drives, it is not worth the time and effort to free up space.

Ivy’s cache refers precisely to this: cache. This is for ALL of your projects that use Ivy. If an older project requires version 1.0.4 for a public jar, it will already be in the Ivy cache and should not be loaded, so, like good caches, it saves you time and effort.

<ivy:cleancache>, : . 1.0.4 jar, 1.1.1. , , , , .

, <ivy:cleancache>: Ivy , . , , .

Ivy, , <ivy:cleancache> :

<delete dir="${ivy.cache.dir}" />

, selector:

<delete dir="${ivy.cache.dir}">
    <date datetime="01/01/2010 12:00 AM" when="before"/>
    <include name="*.jar"/>
</delete>

, , .

Ivy . Ivy , , .

+4

ANT "realclean", .

<target name="clean">
    <delete dir="${build.dir}"/>
</target>

<target name="realclean" depends="clean">
    <ivy:cleancache/>
</target>

Doco

+2

Source: https://habr.com/ru/post/1764716/


All Articles