This topic is about Apache IVY – Shared Repository.
A shared repository is a team level shared repository of a team. It is very common to be overridden in organizations.
Default Location
By default, shared repository is present in ${ivy.default.ivy.user.dir}/shared folder. If you want to change it, the use the ivy.shared.default.root variable in ant file.
build.xml
<target name="resolve"> <property name="ivy.shared.default.root" value="/opt/ivy/repository/shared"/> <ivy:resolve /> </target>
Other properties like ivy pattern and artifact pattern can also be customized as follows −
build.xml
<target name="resolve"> <property name="ivy.shared.default.root" value="/opt/ivy/repository/shared"/> <property name="ivy.shared.default.ivy.pattern" value="[organisation]/[module]/[revision]/ivy.xml"/> <property name="ivy.shared.default.artifact.pattern" value="[organisation]/[module]/[revision]/[artifact].[ext]"/> <ivy:resolve /> </target>
Overriding ivysettings defaults
By default ivy has its configurations in ivysettings.xml present in ivy.jar.
ivysettings.xml
<ivysettings> <settings defaultResolver="default"/> <include url="${ivy.default.settings.dir}/ivysettings-public.xml"/> <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/> <include url="${ivy.default.settings.dir}/ivysettings-local.xml"/> <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/> <include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/> </ivysettings>
To override shared repository setting, update the contents of ivysettings-shared.xml.
ivysettings-shared.xml
<ivysettings> <property name="ivy.shared.default.root" value="${ivy.default.ivy.user.dir}/shared" override="false"/> <property name="ivy.shared.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/> <property name="ivy.shared.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/> <resolvers> <filesystem name="shared"> <ivy pattern="${ivy.shared.default.root}/${ivy.shared.default.ivy.pattern}" /> <artifact pattern="${ivy.shared.default.root}/${ivy.shared.default.artifact.pattern}" /> </filesystem> </resolvers> </ivysettings>
In this topic we learned about Apache IVY – Shared Repository. To know more, Click Here.