Use Ivy API to get the latest dependency?

We have a simple Ivy repository that we host on an internal server (Apache httpd serves the JARs and their Ivy XML descriptors).

Now I have a need to programmatically determine which latest version of the dependency is in our repo. Thus, if we have two versions of Mockito, our repo might look like this:

mockito/ ==> organisation mockito-all ==> module 1.9.4/ ==> revision # mockito-all-1.9.4.jar mockito-all-1.9.4-ivy.xml 1.9.5/ mockito-all-1.9.5.jar mockito-all-1.9.5-ivy.xml 

It would be nice if with Java I could use Ivy to determine that "1.9.5" is the latest version of the mockito/mockito-all module that we have.

This will most likely not be Ant's task, and instead there will most likely be some custom Java code using the classes that exist inside ivy.jar .

Any ideas? Thanks in advance!

+4
source share
2 answers

I believe that you can use the latest.integration version latest.integration to indicate the absolute latest version. For example, list your Ivy dependency as follows:

 <dependency org="mockito" name="mockito-all" rev="latest.integration" /> 

You can also specify latest.milestone or latest.release if you do not need the "edge" version. Here is a good explanation of the meaning of rev : http://ant.apache.org/ivy/history/latest-milestone/ivyfile/dependency.html

0
source

So, I found your question is to do the same, and after some research it turned out that such a thing exists in Ivy 2.4.

http://ant.apache.org/ivy/history/latest-milestone/use/checkdepsupdate.html

Here is an example:

 <target name="ivy.outdated" description="Check ivy for outdated jars"> <ivy:resolve/> <ivy:checkdepsupdate showTransitive="false" revisionToCheck="latest.release"/> </target> 
0
source

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


All Articles