Hello,

At the Howard Hughes Medical Institute Janelia Research Campus, we encountered 
an issue with transitive dependencies when using the IJava [1] Jupyter kernel 
that uses Apache Ivy for dependency resolution.

When adding the dependency org.janelia.saalfeld.lab.n5-ij [2] Ivy does not 
correctly recognize net.imglib2.imglib2 [3] as a compile dependency. This is 
because when processing the parent POM (pom-scijava [4]), Ivy only stores extra 
information with a groupId__artifactId key without the classifier.

The initial fix I have produced is to modify the key to include the classifier: 
groupId__artifiactId__classifierId. I have prototyped these changes on a Github 
fork [5]. I would like to discuss how we might upstream these changes to Apache 
Ivy.

Sincerely,

Mark Kittisopikul, Ph.D.

Software Engineer II
Computational Methods, Scientific Computing
Janelia Research Campus
Howard Hughes Medical Institute

[1] https://github.com/SpencerPark/IJava
[2] https://github.com/saalfeldlab/n5-ij
[3] https://github.com/imglib/imglib2
[4] https://github.com/scijava/pom-scijava
[5] https://github.com/mkitti/ant-ivy/commits/mkitti-maven-classifier


P.S. Some details on n5-ij to imglib2 dependency chain.

n5-ij declares a dependency on n5-imglib2
https://github.com/saalfeldlab/n5-ij/blob/86ac6eb7c2dd77f57cb145902a974f6dc55038f3/pom.xml#L109

n5-imglib2 declares a dependency on imglib2
https://github.com/saalfeldlab/n5-imglib2/blob/20d5051e01aa88afafc040293813fb85a1bd1761/pom.xml#L173-L176

The parent POM for both above projects is pom-scijava which contains a maven 
dependency management section. The dependency management section contains two 
entries for net.imglib2.imglib2
Unclassified dependency setting the imglib2 version to 6.1.0:
https://github.com/scijava/pom-scijava/blob/9faccfc99fe969bf1b59b5b24d5f446b7f782a14/pom.xml#L2807-L2811
Dependency with tests classifier adding net.imglib2.imglib2 as a dependency 
with a test scope.
https://github.com/scijava/pom-scijava/blob/9faccfc99fe969bf1b59b5b24d5f446b7f782a14/pom.xml#L6623-L6629

I have posted some minimal configuration files here for testing:
https://github.com/mkitti/minimal_n5_ij_ivy_test

The abbreviated output of `mvn dependency:tree` is as follows.

[INFO] \- org.janelia.saalfeldlab:n5-ij:jar:3.2.6:compile
[INFO]    +- org.janelia.saalfeldlab:n5-imglib2:jar:7.0.0:compile
[INFO]    |  +- net.imglib2:imglib2:jar:6.1.0:compile

What I would expect to see from Ivy but I only do after applying my patches:

[ivy:dependencytree] \- org.janelia.saalfeldlab#n5-ij;3.2.6
[ivy:dependencytree] |  +- org.janelia.saalfeldlab#n5-imglib2;7.0.0
[ivy:dependencytree] |  |  +- net.imglib2#imglib2;6.1.0

Appling the patches requires that the Ivy cache (default ~/.ivy2/cache) be 
invalidated.

The current dependency management entries from pom-scijava are currently parsed 
by Ivy as follows, which causes imglib2 to be wrongly classified as a test 
rather than compile dependency:

        <m:dependency.management__net.imglib2__imglib2__ 
version>6.1.0</m:dependency.management__net.imglib2__imglib2__defaultclassifier__version>
        
<m:dependency.management__net.imglib2__imglib2__scope>test</m:dependency.management__net.imglib2__imglib2__tests__scope>

After my patches the dependency management entries are as follows with a 
classifier entry. With my changes, under the default classifier, imglib2 is now 
correctly scoped as a compile dependency.

        
<m:dependency.management__net.imglib2__imglib2__defaultclassifier__version>6.1.0</m:dependency.management__net.imglib2__imglib2__defaultclassifier__version>
        
<m:dependency.management__net.imglib2__imglib2__tests__version>6.1.0</m:dependency.management__net.imglib2__imglib2__tests__version>
        
<m:dependency.management__net.imglib2__imglib2__tests__scope>test</m:dependency.management__net.imglib2__imglib2__tests__scope>


Reply via email to