0

A repository linked in a dependency's pom should be used when handling its dependencies (according to the question Are Maven repository declarations transitive?). Unfortunately, it doesn't happen in my case.

My project has dependency org.apache.calcite:calcite-avatica:1.0.0-incubating. The pom of calcite-avatica requires the dependency eigenbase:eigenbase-properties:1.1.4 and adds conjar repository in <repositories>, as this is the only place where eigenbase-properties 1.1.4 can be found. When I try to build the project, I get an error:

Could not find artifact eigenbase:eigenbase-properties:pom:1.1.4 in central (https://repo.maven.apache.org/maven2)

Why is eigenbase-properties not pulled from conjar repository? Only repository from my project is queried, while the linked repository isn't.

My minimal pom for reference:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>unresolved-dependency</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.apache.calcite/calcite-avatica -->
        <dependency>
            <groupId>org.apache.calcite</groupId>
            <artifactId>calcite-avatica</artifactId>
            <version>1.0.0-incubating</version>
        </dependency>
    </dependencies>
</project>

I'm using JDK 1.8 (as seen in the pom) and Maven 3.6.3 (to exclude the possibility that conjar is blocked as an external http repository, which is the default since 3.8.1; see How to disable maven blocking external HTTP repositores?).

It also isn't the case that I have some mirrors specified, as was the cause in the question: maven can't get dependency from transitive repository (sometimes).

oskarryn
  • 170
  • 2
  • 13
  • Do you use a `settings.xml`? Does it have mirror definitions? – J Fabian Meier Feb 09 '22 at 19:40
  • No, `settings.xml` is left out default in the minimal example I try to get running, no mirrors. – oskarryn Feb 09 '22 at 22:02
  • Can't reproduce, I see this:Downloading from conjars: http://conjars.org/repo/eigenbase/eigenbase-properties/1.1.4/eigenbase-properties-1.1.4.pom Downloaded from conjars: http://conjars.org/repo/eigenbase/eigenbase-properties/1.1.4/eigenbase-properties-1.1.4.pom (4.3 kB at 10 kB/s) – Robert Scholte Feb 10 '22 at 12:36
  • If you run `mvn validate -X` you'll see the locations of the `settings.xml`. – Robert Scholte Feb 10 '22 at 12:38
  • I tried exactly the same in WSL (ubuntu) and it works there... Same Maven version, jdk version, pom, settings etc. works right away... It must be Window's fault somehow. I'd say some networking issue like firewall must be the reason, but that would block WSL too.. So no idea what it is, but this could be reproduced only under Windows. @Robert Scholte, what OS did you use? – oskarryn Feb 10 '22 at 13:00
  • Unlikely to be OS related, I use Windows :) – Robert Scholte Feb 10 '22 at 15:13
  • Ok, I reinstalled the whole java & maven (same distributions), restarted the firewall to defaults, restarted pc, and now it works in Windows too... I have no idea what was wrong before, it will remain a great mystery to me. Still, thanks for helping! – oskarryn Feb 10 '22 at 16:33

1 Answers1

0

There is no such a "transitive repository" resolution in the documentation of Maven: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Rusi Popov
  • 377
  • 1
  • 6
  • I haven't found anything in Maven docs either, but the accepted answer to this question: https://stackoverflow.com/questions/63812808/are-maven-repository-declarations-transitive indicates there is such thing as "transitive repository". – oskarryn Feb 09 '22 at 22:11