Consuming multiple jars from one Ivy dependency


(Martin Linha) #1

Hi

I need to consume few jars from Ivy repository with following layout

                    layout 'pattern', {
                        artifact '[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]'
                        ivy '[organisation]/[module]/[revision]/[type]s/ivy-nexus.xml'
                        m2compatible = true
                    }

In [organisation]/[module]/[revision]/[type]s/ ivy-nexus.xml I have publications similar to

<publications>
  <artifact name="A" type="jar" ext="jar" conf="main"/>
  <artifact name="A" type="source" ext="jar" e:classifier="src" conf="sources"/>
  <artifact name="B" type="jar" ext="jar" conf="main"/>
  <artifact name="B" type="source" ext="jar" e:classifier="src" conf="sources"/>
</publications>

Then I have jars in following locations

[organization]/[module]/[revision]/jars/A.jar
[organization]/[module]/[revision]/jars/B.jar

in build.gradle

dependencies {
  compile '[organisation]:[module]:[revision]'
}

where values in brackets are of course actual values.

When I check the resolved dependencies, Gradle uses only A.jar. How can tell Gradle to use B.jar as well? Or is the problem that the jars in Ivy repository does not have classifiers to specify which one to use?

Many thanks!


(Martin Linha) #2

Oh, found the answer here