Reputation: 361
I have an environment where (basically) all dependencies of anything built need to be pulled from our artifactory repository, and at the same time many 3rd party libraries need to be built from source (usually with very minor automated changes) and stored in the repository to be used as a dependency in the future. The reason this is done is outside of my control and not something that can be changed. I am looking for the best way to point these 3rd party libraries to our repository after pulling their source from github or wherever, starting with anything using ivy (not everything is using ivy, at a minimum maven and gradle are used as well, but ivy is used a lot, so starting there).
I have read up a fair bit on the ivy options for changing the default repository for one project (Here and other sites), but want to try and do a more wide-scale solution which could save a lot of time in the long run. One option I thought of would be to modify the ivysettings-public.xml file so the default ivy public repository is actually our artifactory. Two issues I see with this are its possible for a project to have set a specific repository to check before the default public one, though I don't know how common that is. Also this might require building ivy from source? Not an impossible task, just extra work, though I'm again not sure if it will or won't. But I'm pretty sure I know (or could easily figure out) how to do what is needed for this solution.
Another possible option would be to have some type of module or middle man that attaches to ivy and intercepts repository requests, redirecting them to our artifactory. This one I'm not actually sure if its possible or not, but it seems like it might be.
I know there might be some environment variables or ANT properties that could be set before the build call that might also work (from the same link as before). This isn't quite as ideal but is still much better then changing the ivysettings.xml file for each project.
Basically the end goal of this would be that we could pull a project from github that uses ivy, build it with no changes to the code, and have all dependency calls look at our artifactory repository. This would also be done with things that use maven or gradle and so on, but it seemed that a one size fits all solution is either not possible or more work then it's worth (I could always be wrong though), so starting with ivy. I feel like my first idea is the best combination of time saving and feasibility, but I know just enough to know that it's likely there's a better option.
Upvotes: 0
Views: 848
Reputation: 10182
You don't need to bother with default repository. I see that in that page you've linked that terminology might seem confusing to someone new to ivy. These are just some types of repositories, but nothing you need to be concerned with.
Only thing you need to do is to set up a chained resolver in the ivysettings.xml. Within that chained resolver you can add as many (sub)resolvers as you want, one of them can be you artifactory, the other some public repository (like maven central), third some local filesystem resolver for testing etc... Whenever you use ivy, just tell it to use this chained resolver, or make it a default one in ivysettings.
Of course when publishing you ivy modules, make sure to use one of the child/sub resolvers, I'm guessing you would use on pointing to an ivy repo in your artifactory.
Upvotes: 1