kwin opened a new issue, #2366:
URL: https://github.com/apache/maven-resolver/issues/2366

   ### Affected version
   
   Maven 3.9.16 (but probably also 2.x resolver)
   
   ### Bug description
   
   I use multiple remote repositories.
   Checking the highest version and then resolving (via API from 
https://github.com/bndtools/bnd/blob/0ca31d7acb96158049b56bc1749f4956ce5d1517/maven-plugins/bnd-baseline-maven-plugin/src/main/java/aQute/bnd/maven/baseline/plugin/BaselineMojo.java#L203)
 leads to the following logs 
   
   ```
   [INFO] Determining the baseline version for 
be.orbinson.aem:aem-dictionary-translator.core:jar:(,1.7.1-SNAPSHOT) using 
repositories [sonatype-central-portal (https://repo.maven.apache.org/maven2, 
default, releases+snapshots), central (https://repo.maven.apache.org/maven2, 
default, releases), nexus-netcentric 
(https://repo.int.netcentric.biz/nexus/content/groups/netcentric/, default, 
releases+snapshots)]
   [INFO] Created Njord artifact store aem-dictionary-translator-00002 for 
remote repository sonatype-central-portal 
(https://repo.maven.apache.org/maven2, default, releases+snapshots)
   INFO] Downloading from aem-dictionary-translator-00002: 
file:///Users/715508/.njord/aem-dictionary-translator-00002/be/orbinson/aem/aem-dictionary-translator.core/maven-metadata.xml
   [INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/be/orbinson/aem/aem-dictionary-translator.core/maven-metadata.xml
   [INFO] Downloading from nexus-netcentric: 
https://repo.int.netcentric.biz/nexus/content/groups/netcentric/be/orbinson/aem/aem-dictionary-translator.core/maven-metadata.xml
   [INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/be/orbinson/aem/aem-dictionary-translator.core/maven-metadata.xml
 (1.2 kB at 5.8 kB/s)
   [WARNING] Could not transfer metadata 
be.orbinson.aem:aem-dictionary-translator.core/maven-metadata.xml from/to 
nexus-netcentric 
(https://repo.int.netcentric.biz/nexus/content/groups/netcentric/): 
repo.int.netcentric.biz: nodename nor servname provided, or not known
   [INFO] The baseline version was found to be 1.7.0
   [INFO] Downloading from aem-dictionary-translator-00002: 
file:///Users/715508/.njord/aem-dictionary-translator-00002/be/orbinson/aem/aem-dictionary-translator.core/1.7.0/aem-dictionary-translator.core-1.7.0.jar
   [INFO] Downloading from nexus-netcentric: 
https://repo.int.netcentric.biz/nexus/content/groups/netcentric/be/orbinson/aem/aem-dictionary-translator.core/1.7.0/aem-dictionary-translator.core-1.7.0.jar
   ...
   [ERROR] Failed to execute goal 
biz.aQute.bnd:bnd-baseline-maven-plugin:7.4.0:baseline(baseline)on project 
... Unable to locate a previous version of the artifact
   
   ```
   
   This seems to be a race condition as depending on which remote repository of 
the first returns first determines the outcome. Although the artifact is 
available on `central` 
(https://repo.maven.apache.org/maven2/be/orbinson/aem/aem-dictionary-translator.core/1.7.0/aem-dictionary-translator.core-1.7.0.jar)
 it is not in in `nexus-netcentric`. Resolving from the latter leads to a 
`org.eclipse.aether.RepositoryException` (wrapping a 
`java.net.UnknownHostException`).
   
   The culprit is probably within 
https://github.com/apache/maven-resolver/blob/54aa1d621c87912482b56c43222e93aaa6535124/maven-resolver-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java#L220
 which tries to download in parallel from all remote repos.
   Once a single thread hits an exception this leads to propagating the 
exception to the caller, without waiting for any of the other remote repos.
   
   In my case the exception is a 
[`UnknownHostException`](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/net/UnknownHostException.html)
 (which is unfortunately swallowed in 
https://github.com/bndtools/bnd/blob/0ca31d7acb96158049b56bc1749f4956ce5d1517/maven-plugins/bnd-baseline-maven-plugin/src/main/java/aQute/bnd/maven/baseline/plugin/BaselineMojo.java#L137)
 and therefore not visible in the logs above.
   
   I would argue the outcome should not depend on the fastest responding remote 
repo. If one fails with an exception the other remote repos should still be 
tried.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to