I have 3 projects of the following structure:
App
| |
...
| |
| +--lib
| | |
| | +--...
| |
| +--dist
|
Lib
| |
...
| |
| +--lib
| | |
| | +--sublib-1.0.jar
| |
| +--dist
| |
| +--lib-1.0.jar
|
SubLib
|
...
|
+--dist
|
+--sublib-1.0.jar
Which have the following relation:
App <-- Lib <-- SubLib
I am using apache ivy to retrieve the dependencies for both App
and Lib
. The dependencies are described as follows:
ivy.xml
of Lib
:
<ivy-module version = "2.0">
<info organisation = "com.test.lib" module = "lib"/>
<dependencies>
<dependency org = "com.test.sub.lib" name = "sublib" rev = "1.0" conf = "compile->default"/>
</dependencies>
</ivy-module>
ivy.xml
of App
:
<ivy-module version = "2.0">
<info organisation = "com.test.app" module = "App"/>
<dependencies>
<dependency org = "com.test.lib" name = "lib" rev = "1.0" conf = "compile->default"/>
</dependencies>
</ivy-module>
ivysettings.xml
:
<ivysettings>
<settings defaultResolver = "local"/>
<resolvers>
<filesystem name = "local">
<artifact pattern = "${ivy.settings.dir}/SubLib/dist/[artifact]-[revision].[ext]"/>
<artifact pattern = "${ivy.settings.dir}/Lib/dist/[artifact]-[revision].[ext]"/>
</filesystem>
</resolvers>
<modules>
<module organisation = "com.test.ivytest" resolver = "local"/>
</modules>
</ivysettings>
Expected result: after executing ivy:retrieve
, both sublib-1.0.jar
and lib-1.0.jar
to be present in App/lib
Actual result: only lib-1.0.jar
is present in App/lib
. The generated ivy-report for App
does not contain any mention of sublib
being a dependency of lib
. Nothing of a sort is in ant + ivy logs during build as well.
Note: lib-1.0.jar
is not being built as a fat-jar.
What am I missing in this configuration?
Update
I've done some thinking, and the only conclusion I came with is that this problem is indeed misconfiguration. Judging by the fact, that transitive dependency is not retrieved, we can positively say that ivy does not have any information of a sort when it resolves lib
. And that makes sense, because Lib/dist
folder could be anywhere in the file system. The only way to have information about transitive dependency would be having respective ivy.xml
somewhere close to that jar. Which is not. This is slightly confirmed by the message in logs [ivy:retrieve] local: no ivy file found for com.test.lib#lib;1.0: using default data
. The only way that information is preserved is cache data in %user%/.ivy/cache
. There the generated [org]-[artifact]-[conf].xml
files do contain the dependency information. So I'm guessing for that to work properly, I will have to use cache on App's resolution level.
Does that make any sense or am I plainly wrong again?
[ivy:retrieve]
sections in logs that it does perform a resolve. I get no errors, it's just transitive jar dependencies missing. – Bodhisattvalib
andsublib
. – Boeotianivy:cleancache
is explicitly called duringApp.clean
ant task. It's just not mentioned. I'm testing one idea at the moment, if it works properly, I'll post it here. – Bodhisattva