[
https://issues.apache.org/jira/browse/MNG-6759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16942671#comment-16942671
]
Stig Rohde Døssing commented on MNG-6759:
-----------------------------------------
But Maven does inherit/use repos listed in the POM of a dependency, when
resolving that dependency's transitive dependencies. This is the behavior Maven
had up to 3.6.1, and also the behavior it has when not using the ASF parent POM.
Going to describe how I think 3.6.1 behaves when a project depends on B in the
example: Maven sees the dependency on B. It fetches the B artifact and POM from
Maven Central. It reads B's POM to find the transitive dependencies. When
resolving the transitive dependencies of B, it checks the <repositories> listed
in B's POM, in this case the Confluent repo. It downloads kafka-avro-serializer
from the Confluent repo.
To justify why I think this behavior is desirable:
Let's say I want to publish artifact B on Maven Central. I would want people to
be able to depend on B without investigating where B's transitive dependencies
are hosted. If a user adds a dependency on B, they shouldn't have to manually
add a <repository> to their POM. If Maven didn't read B's repositories when
resolving transitive dependencies for B, I'd have to let users know through
some out of band method (e.g. a website) that they have to add the Confluent
repository to their POMs. This requirement would be viral, so my users would
have to also let their users know that Confluent must be added to their POMs.
With the 3.6.1 behavior, I can just publish B on Maven Central, and Maven will
fetch kafka-avro-serializer from the Confluent repo if necessary.
> Maven fails to use <repositories> section from dependency when resolving
> transitive dependencies in some cases
> --------------------------------------------------------------------------------------------------------------
>
> Key: MNG-6759
> URL: https://issues.apache.org/jira/browse/MNG-6759
> Project: Maven
> Issue Type: Bug
> Affects Versions: 3.6.2
> Reporter: Stig Rohde Døssing
> Priority: Major
>
> With Maven 3.6.2, I get the following error on a project using the ASF parent
> POM version 21:
> {quote}
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process
> (process-resource-bundles) on project ChildA: Failed to resolve dependencies
> for one or more projects in the reactor. Reason: Missing:
> [ERROR] ----------
> [ERROR] 1) io.confluent:kafka-avro-serializer:jar:1.0
> [ERROR]
> [ERROR] Try downloading the file manually from the project website.
> [ERROR]
> [ERROR] Then, install it using the command:
> [ERROR] mvn install:install-file -DgroupId=io.confluent
> -DartifactId=kafka-avro-serializer -Dversion=1.0 -Dpackaging=jar
> -Dfile=/path/to/file
> [ERROR]
> [ERROR] Alternatively, if you host your own repository you can deploy the
> file there:
> [ERROR] mvn deploy:deploy-file -DgroupId=io.confluent
> -DartifactId=kafka-avro-serializer -Dversion=1.0 -Dpackaging=jar
> -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
> [ERROR]
> [ERROR] Path to dependency:
> [ERROR] 1) io.github.srdo:ChildA:jar:0.0.1-SNAPSHOT
> [ERROR] 2) io.github.srdo:ChildB:jar:0.0.1-SNAPSHOT
> [ERROR] 3) io.confluent:kafka-avro-serializer:jar:1.0
> [ERROR] ----------
> [ERROR] 1 required artifact is missing.
> [ERROR]
> [ERROR] for artifact:
> [ERROR] io.github.srdo:ChildA:jar:0.0.1-SNAPSHOT
> [ERROR]
> [ERROR] from the specified remote repositories:
> [ERROR] apache.snapshots (https://repository.apache.org/snapshots,
> releases=false, snapshots=true),
> [ERROR] central (https://repo.maven.apache.org/maven2, releases=true,
> snapshots=false)
> {quote}
> This build works on Maven 3.6.1. I've put up a reproduction at
> https://github.com/srdo/Maven362RepositoriesRegression
> I've found the following workarounds:
> * Dropping the ASF parent POM. Maybe there's a plugin version in there Maven
> 3.6.2 doesn't like?
> * Copying the <repositories> section from ChildB into ChildA
--
This message was sent by Atlassian Jira
(v8.3.4#803005)