So, let’s assume that I have an already installed SVN and installed ANT / Ivy locally.
I want to have the “shared” part of the ivy config point to some kind of share on a server. How would I need to set this up?
I know I have to dig through the ivy jar and pull out the ivysettings file and modify shared repositories.
So let’s assume that I have a server on my intranet at MyServer.intranet.net and my team’s folder was under /path/to/NetAdmin (thus the full path would be MyServer.intranet.net/path/to/NetAdmin ) How would I get this set up as a team repository for shared libraries? Would I just specify it and when I package the projects it writes the dependencies there?
Thanks
Here what I did:
ivy.dir.ivy.dirproject, I have the latest ivy.jar.ivy.dir, I have theivysettings.xmlsetup for our environment. For example, we use a local Artifactory Maven repository for our own jars. Theivysettings.xmlin theivy.dirproject points to that.ivy.tasks.xml. This is an Ant build file.The
ivy.tasks.xmllooks like this:Notice that I have my own Ivy settings, thank you. I didn’t have to munge up the one in the
ivy.jar(although I could have since everyone will use myivy.jarfile!). Myivysettings.xmllooks like this:The big change is the
ivysetting-public.xmlfile:It’s pointing to my local Maven repository — my Artifactory server.
Now, for a developer to use Ivy, all they have to do is:
svn:external. Thissvn:externalwill be used to bring myivy.dirproject into their Subversion project.build.xmlin the<project>definition.ivy.dirto `${basedir}/ivy.dir.<import>task to import${ivy.dir}/ivy.tasks.xmlinto theirbuild.xmlfile.Something like this:
This solves a lot of problems:
ivy.settingsand everyone will have the updated settings. This ended up being very important to us because we use Jenkins and I wanted Jenkins to clean the ivy cache on each build. Whoops! That cleans out the ivy cache on builds that are being executed at the same time! I solved the problem by changing theivysettings.xmlfile to define a different Ivy cache for each Jenkins build executor. One the Jenkins server, you have Ivy caches called$HOME/.ivy2/cache-0,$HOME/.ivy2/cache-1, etc. Each executor can delete it’s own Ivy cache without affecting the others. Users, meanwhile will just have$HOME/.ivy2/cache-0.ivy.dirandivy.tasks.xmlfile to install other tasks. For example, each of our projects must run itself through Findbugs, PMD, CPD (part of the PMD project, Checkstyle, and use JaCoCo. for test coverage.Each one of these projects consist of a jar file, and a
<taskdef>to pull the task definitions into Ant. And, how do you use these tasks too? They’re not defined in the standard Ant model. Developers don’t know how to use them.I’ve added these jars into my
ivy.dirproject, and installed all of those task definitions into myivy.tasks.xmlfile. I also defined easy to use<macrodef>for most of these tasks, so it’s easy for the developers to use them. In fact, I’ve even included the old Ant-Contrib tasks just for fun.Now, once you add
ivy.dirinto your project, you have all of these extra tasks, and you have nothing to install on your machine.