This chapter explains the IvyDE Settings which are useful to enable project specific behavior. Settings are managed through IvyDE Managed Libraries window that has tabs for Settings, Retrieve and Advanced.
IvyDE Managed Libraries
To manage Ivy settings in Eclipse, you need to open IvyDE Managed Libraries window and to open that, there should be an Ivy Library in the project build path which is added using Add Ivy Library, as explained in the last chapter.
To open the IvyDE Managed Libraries window, select project in the Project Explorer and right click to get the context menu and then choose Build Path → Configure Build Path which shows the Java Build Path window. Select the Libraries tab which shows the ivy.xml[*] library among others. There select ivy.xml[*] library and click Edit which pops up the IvyDE Managed Libraries window.
Let’s try out some of the IvyDE Settings.
In Apache Ivy Shared Repository, we used ivysettings.xml to access a shared web respository through a custom resolver named web. We use Settings tab of IvyDE to override the default settings with an ivysettings.xml. This may be either done at workspace level or at project level. Place the ivysettings.xml in root folder of workspace to enable custom settings at workspace level or in root folder of the project for custom settings at project level.
For project level settings, select Enable project specific settings checkbox and set Ivy settings path field to ivysettings.xml file. For workspace level settings, use Configure Workspace Settings link which takes you to Eclipse Preferences window where you may set the ivysettings.xml. (for workspace level setting you may also use Window → Preferences → Ivy → Settings).
Figure 9.1. IvyDE Settings Tab
Apache Ivy Retrieve task copies the resolved dependencies to the project workspace. In IvyDE, we can enable retrieve at two levels either at the workspace level or at the project level.
Enable IvyDE Retrieve at project level
To set retrieve at project level, open Ivy Managed Libraries window and select Retrieve tab. Make changes as shown in the screenshot and save the settings.
Figure 9.2. IvyDE Retrieve Tab
These settings indicate that
IvyDE has to retrieve after resolve.
lib/[artifact]-[revision]-[type].[ext]places the retrieved modules in lib directory.
delete stale artifacts which are no longer in dependencies list and lying in lib directory.
Types - jar means we want only actual library jar files and not javadoc, source jar, etc. Multiple comma separated types are allowed like jar, bundle, etc.
Refresh the project with F5 and Ivy creates lib directory in root folders of the project and copies the resolved artifacts to it.
Enable IvyDE Retrieve at workspace level
Go to Window → Preferences → Ivy → Retrieve
Figure 9.3. IvyDE Retrieve Tab
Make changes as shown in next the screenshot and save settings
Figure 9.4. IvyDE Retrieve Tab
Refresh the project with F5. Ivy creates a lib directory in root folders of the project (only in those projects which have ivy.xml[*] library in their build path and there is no project specific settings) and copies the resolved jars to it.
In our opinion, out of the two, project level setting is the better option.
This tab is used to
define accepted types
define source types and suffixes
defines javadoc types and suffixes
change ordering of classpath entries
Again, these things can be set at the workspace level or at the project level.
That brings us to the end of the Apache Ivy Beginners Guide. In this guide, we have covered some of the essential concepts and usage of Apache Ivy which assists developers to start using Apache Ivy in their projects.
But it’s just the start: Apache Ivy comes with many additional features to meet the rigorous needs of an enterprise dependency management system. Below, we provide some of the pointers for users to gain further insight into Apache Ivy and help them to convert their build system into a professional one.
Tutorials - Official documentation contains set of tutorials which explains some of the advanced features. These tutorials walk through the examples provided in src/example directory of Apache Ivy distribution.
Reference Documentation - Official documentation also contains detailed Reference documentation which covers following areas
Setting Files – defines the structure of ivysettings.xml and the allowed tags.
Ivy Files - defines the structure of ivy.xml and the allowed tags.
Ant Tasks – provides reference about the various Apache Ivy Ant tasks.
Ivy Module Configuration - In this guide, we used the default configuration named default. Apache Ivy comes with a powerful feature known as Module Configurations which groups a set of artifacts and gives meaning to it. Official tutorial – Using Ivy Module Configurations explains this concept.