Ivy cannot load artifact dependencies located in the local Maven repository

I have artifact A installed in the local Maven repository.

Artifact A has a number of dependencies correctly defined in pom.

If I install A as a dependency in a Maven project, everything is fine - both A and its dependencies load correctly. This tells me that A is correctly installed in the local Maven repository and that its dependencies were correctly specified.

I also have an Ant / Ivy project. I configured the ivysettings.xml file as follows (following the recommendations of another answer):

<ivysettings> <settings defaultResolver="default"/> <property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" /> <resolvers> <chain name="default"> <filesystem name="local-maven2" m2compatible="true" > <artifact pattern="${m2-pattern}"/> <ivy pattern="${m2-pattern}"/> </filesystem> <ibiblio name="central" m2compatible="true"/> </chain> </resolvers> </ivysettings> 

With this configuration, Ivy loads A correctly, but not its dependencies (it seems to completely ignore its pom file).

How do I need to change my setting so that dependencies will be loaded?

0
source share
3 answers

Although Mark O'Connor's answer is the correct answer and a reasonable way to solve the problem, I managed to find another solution that implies less installation overhead.

So, I converted the POM of artifact A to an Ivy file - through the Ant ivy:convertpom . Note that unlike the POM standard, the Ivy file should be named as follows: ivy-<your lib revision>.xml .

Then I just set up the local Ivy repository, pointing to the folder where the artifact A and its Ivy file are located, for example:

 <ivysettings> <property name="my-local-ivy-dependencies-jars.repository" value="${user.dir}\..\my-local-ivy-dependencies-jars/lib"/> <property name="my-local-ivy-dependencies-jars.pattern" value="${my-local-ivy-dependencies-jars.repository}/[organisation]/jars/[artifact]-[ revision].[ext]"/> <settings defaultResolver="default"/> <resolvers> <chain name="default"> <filesystem name="my-local-ivy-dependencies-jars"> <ivy pattern="${my-local-ivy-dependencies-jars.pattern}" /> <artifact pattern="${my-local-ivy-dependencies-jars.pattern}" /> </filesystem> <ibiblio name="central" m2compatible="true"/> </chain> </resolvers> </ivysettings> 
0
source

Maven and ivy repositories have different formats. Simplified installation of Maven uses POM files, while ivy uses ivy files.

The good news is that ivy has a special iniblio resolver that is designed to understand the format of the Maven repository. The bad news is that it assumes that such a repository works remotely, for example, using software such as Nexus , Artifactory or Achiva .

For instance:

 <ivysettings> <settings defaultResolver="repos" /> <resolvers> <chain name="repos"> <ibiblio name="central" m2compatible="true"/> <ibiblio name="my-releases" m2compatible="true" root="https://myhost/releases"/> </chain> </resolvers> </ivysettings> 

Demonstrates how to pull dependencies on Maven central and the Maven repository running locally

In conclusion, launching Maven local storage is not a complicated and best way to exchange artifacts between all types of build technologies: Maven, ANT / ivy, Gradle, SBT, etc.

0
source

To complement Mark O'Connor's answer, you can actually use the local URL using the file:// scheme. The following works for me on Windows (note the triple slash after the diagram):

 <ivysettings> <settings defaultResolver="local-maven" /> <resolvers> <ibiblio name="local-maven" m2compatible="true" root="file:///c:/path/to/maven/repo" pattern="[orgPath]/[module]/[revision]/[artifact]-[revision].[type]"/> </resolvers> </ivysettings> 

My use of this was to extract android sdk dependencies in an ant build with ivy.

0
source

All Articles