Let's say I have an ivy.xml
that contains the following:
<dependency org="checkstyle" name="checkstyle" rev="4.3" />
And then I want to upgrade to Checkstyle 4.4, so I change my ivy.xml
to contain:
<dependency org="checkstyle" name="checkstyle" rev="4.4" />
After a retrieve
with the first configuration, I have the file checkstyle-4.3.jar
. After the second configuration, I also have the file checkstyle-4.4.jar
, and the file checkstyle-4.3.jar
still exists.
Is there a way to have Ivy realize that the old file is an orphan, and remove it from the lib
directory? The idea is that I don't want my developers' disk space usage to drastically increase every time I upgrade a tool.
Ideally I'd also want it removed from the local repository as well. I do realize that the intent of the local repository is that it is shared among projects, so it would not make sense to remove anything, as it would not know if the artifact was still in use in other projects. But there must be some kind of prune procedure...
I've been using Ivy 2.0.0, so I don't know if this applies to the version you're using.
The Ivy retrieve
task has a sync
attribute. Set this to true
and unused/unknown files in your retrieved directory (lib
in your case) will be removed. Keep in mind this will mean any manually copied artifacts in this directory which Ivy doesn't specifically resolve will be removed.
Also, note that if you use the sync
option but Ivy resolves no dependencies (empty or missing ivy.xml
, for example), the retrieve directory will be deleted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With