A few weeks back, we released the 2.5.0-rc1 version of Apache Ivy. Apache Ivy is a dependency management build tool, which usually is a used in combination with Apache Ant. The download is available on the project download page
This release is significant since the last release of Apache Ivy was way back in December 2014. So it’s more than 3 years since the last official years. During these past few years, the project development stalled for a while. I use Apache Ivy in some of our projects and have been pretty happy with the tool. It’s never a good sign to see one of your heavily used tools to be no longer under development or even have bug fixes. So a year or so back, I decided to contribute some bug fixes to the project. Over time, the project management committee invited me to be part of the team.
We decided that the first obvious, immediate goal would be to revive the project and do a formal release with bug fixes. This 2.5.0-rc1 is the result of that effort which started almost a year back. A lot of changes have gone into this release and also a good number of enhancements have made it into this release. This release has been a result of contributions from various different members from the community. The complete list of release notes is available here
We intentionally named this release 2.5.0-rc1 (release candidate) since it’s been a while we have done an official release and also given the nature of changes. Please give this release a try and let us know how it goes. Depending on the feedback, we will either release 2.5.0 or 2.5.0-rc2. As usual, some of us from the development team keep an active watch in the ivy user mailing
list. So if you have any feedback or questions, please do drop a mail to us, there.
Now coming to one of the enhancements in this release – there’s been more than one. One of the issues I personally had was if the repository, backing a dependency resolver configured for Ivy, had some connectivity issues, the build would just hang. This was due to the inability to specify proper timeouts for communicating with these repositories through the resolver. As of this release, Ivy now allows you to configure timeouts for resolvers. This is done through the use of (the new) timeout-constraints element in your Ivy settings file. More details about it are
here. Imagine you have a url resolver which points to some URL. The URL resolver would typically look something like:
<url name="foo"> <ivy pattern=.../> <artifact pattern=.../> <artifact pattern=.../> </url>
Let’s now try and configure a connection timeout for this resolver. The first thing you would do is define a named timeout-constraint, like below:
<timeout-constraints> <timeout-constraint name="timeout-1" connectionTimeout="60000" /> </timeout-constraints>
The value for the name attribute can be anything of your choice. The value for connectionTimeout attribute is represented as a timeout in milli seconds. In the above example, we configure the “timeout-1” timeout-constraint to be of 1 minute. You can even specify a readTimeout which too is in milli seconds. More about this element can be found in the
As you might notice, we have just defined a timeout-constraint here but haven’t yet instructed Ivy to use this constraint for some resolver. We do that in the next step, where we set the “timeoutConstraint” attribute on the URL resolver that we had seen before:
<url name="foo" timeoutConstraint="timeout-1"> <ivy pattern=.../> <artifact pattern=.../> <artifact pattern=.../> </url>
Notice that the value of “timeoutConstraint” attribute now points to “timeout-1” which we defined to have a 1 minute connection timeout. With this, when this URL resolver gets chosen by Ivy for dependency resolution, this connection timeout will be enforced and if the connections fails to be established within this timeout, then an exception gets thrown instead of the build hanging forever.
Although the example uses a URL resolver to setup the timeout constraint, this feature is available for all resolvers that are shipped out of the box by Ivy. So you can even use it with the ibiblio resolver (which communicates with Maven central) too.
Like I noted earlier, please do give this release a try and let us know how it goes.
|Published on Java Code Geeks with permission by Jaikiran Pai, partner at our JCG program. See the original article here: Apache Ivy 2.5.0-rc1 released – Now allows timeouts on resolvers|
Opinions expressed by Java Code Geeks contributors are their own.