Hi,
I'm new to Ivy and I think I'm fumbling on what I think is a unique Ivy
set-up...
Facts:
- I have three modules: ModuleA depends on ModuleB depends on ModuleC.
- Resolving dependencies of ModuleB works correctly.
- I am building JavaScript modules where a module may depend on a
"source" artifact of another module (as opposed to a binary).
- I am trying to mimic Maven's SNAPSHOT version convention
- Artifacts are published to a company-internal "shared" Nexus repository
- I have been clearing the ivy cache continually as I change things
- I have read every Ivy documentation page about 10 times each :)
Problems:
- I'm having trouble resolving transitive dependencies, and I'm unsure
where to start troubleshooting.
- Not sure if there is merit or benefit to mimicking Maven's SNAPSHOT
version convention. Is it getting in the way?
- I'm not sure if repository layout is an issue.
- I'm not sure if I'm using configurations correctly.
- I'd like to _not_ have to specify the exact artifact in my
dependencies, but it seems I need to to work with "source" artifacts.
Questions:
- How do I solve the transitive dependency resolution issue?
- Is there a better way to configure Ivy to achieve the equivalent
behaviour?
- Does Ivy have special handling of certain artifact types, such as the
default (binary, I guess), "sources", or "javadoc"?
- Are there any best practices that I am blatantly violating?
Relevant configuration files:
===== ivysettings.xml =====
<ivysettings>
<settings defaultResolver="default"/>
<include url="ivysettings-public.xml"/> <!-- currently unused -->
<include url="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>
===== ivysettings-shared.xml =====
<ivysettings>
<resolvers>
<url name="shared" m2compatible="true">
<artifact
pattern="http://host/nexus/content/repositories/snapshots/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
</url>
</resolvers>
</ivysettings>
===== ModuleC ivy.xml =====
<info organisation="com.company"
module="ModuleC"
revision="1.0-SNAPSHOT" />
<configurations>
<conf name="doc" />
<conf name="source" />
<conf name="runtime" />
</configurations>
<publications>
<artifact name="ModuleC-source" type="source" ext="jar" conf="source" />
<artifact name="ModuleC-jsdoc" type="jsdoc" ext="zip" conf="doc" />
</publications>
===== ModuleB ivy.xml =====
<info organisation="com.company"
module="ModuleB"
revision="1.0-SNAPSHOT" />
<configurations>
<conf name="doc" />
<conf name="source" />
<conf name="runtime" />
</configurations>
<publications>
<artifact type="jar" />
<artifact name="ModuleB-source" type="source" ext="jar" conf="source" />
</publications>
<dependencies>
<dependency org="com.company" name="ModuleC" rev="1.0-SNAPSHOT">
<artifact name="ModuleC-source" conf="source" />
</dependency>
</dependencies>
===== ModuleA ivy.xml =====
<info organisation="com.company"
module="ModuleA"
revision="1.0-SNAPSHOT" />
<configurations>
<conf name="doc" />
<conf name="source" />
<conf name="runtime" />
</configurations>
<publications>
<artifact name="ModuleA" type="jar" conf="runtime" />
</publications>
<dependencies>
<dependency org="com.company" name="ModuleB" rev="1.0-SNAPSHOT">
<artifact name="ModuleB-source" conf="source" />
</dependency>
<!-- I have to have this to resolve this transitive dependency... why? -->
<!-- <dependency org="com.company" name="ModuleC" rev="1.0-SNAPSHOT">
<artifact name="ModuleC-source" conf="source" />
</dependency> -->
</dependencies>
======
When I publish ModuleC, it results in the following files:
[ivy:publish] published ModuleC-jsdoc to
http://host/nexus/content/repositories/snapshots/com/company/ModuleC/1.0-SNAPSHOT/ModuleC-jsdoc-1.0-SNAPSHOT.zip
[ivy:publish] published ModuleC-source to
http://host/nexus/content/repositories/snapshots/com/company/ModuleC/1.0-SNAPSHOT/ModuleC-source-1.0-SNAPSHOT.jar
[ivy:publish] published ivy to
http://host/nexus/content/repositories/snapshots/com/company/ModuleC/1.0-SNAPSHOT/ivy-1.0-SNAPSHOT.xml
When I publish ModuleB, it results in the following files:
[ivy:publish] published ModuleB to
http://host/nexus/content/repositories/snapshots/com/company/ModuleB/1.0-SNAPSHOT/ModuleB-1.0-SNAPSHOT.jar
[ivy:publish] published ModuleB-source to
http://host/nexus/content/repositories/snapshots/com/company/ModuleB/1.0-SNAPSHOT/ModuleB-source-1.0-SNAPSHOT.jar
[ivy:publish] published ivy to
http://host/nexus/content/repositories/snapshots/com/company/ModuleB/1.0-SNAPSHOT/ivy-1.0-SNAPSHOT.xml
I am resolving dependencies in ant like so:
<ivy:resolve />
<ivy:retrieve pattern="lib/[artifact].[ext]" />
After trying to build ModuleA, I only have the following under ModuleA/lib:
ModuleB-source.jar
I also need ModuleC-source.jar in order to build ModuleA.
Thanks,
Troy Kinsella