[ 
https://issues.apache.org/jira/browse/MPIR-473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17909911#comment-17909911
 ] 

ASF GitHub Bot commented on MPIR-473:
-------------------------------------

slawekjaranowski commented on code in PR #92:
URL: 
https://github.com/apache/maven-project-info-reports-plugin/pull/92#discussion_r1903292412


##########
src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependencyManagementRenderer.java:
##########
@@ -194,7 +196,13 @@ private void renderDependenciesForScope(String scope, 
List<Dependency> artifacts
             String[] tableHeader = getDependencyTableHeader(hasClassifier);
             tableHeader(tableHeader);
 
+            List<ArtifactRepository> remoteRpositories = new 
ArrayList<>(buildingRequest.getRemoteRepositories());
+            List<ArtifactRepository> pluginRpositories = new ArrayList<>(
+                    buildingRequest.getPluginArtifactRepositories());
+
             for (Dependency dependency : artifacts) {
+                buildingRequest.setRemoteRepositories(remoteRpositories);
+                
buildingRequest.setPluginArtifactRepositories(pluginRpositories);

Review Comment:
   looks like you set the same repositories list that you read .... effective 
will be 
   
   ```java
   
buildingRequest.setRemoteRepositories(buildingRequest.getRemoteRepositories()) 
   ```
   
   can you create a test which confirm it?
   
   
   





> Do not leak rquests to outside repositories
> -------------------------------------------
>
>                 Key: MPIR-473
>                 URL: https://issues.apache.org/jira/browse/MPIR-473
>             Project: Maven Project Info Reports Plugin
>          Issue Type: Improvement
>          Components: dependencies, dependency-management
>            Reporter: Carsten Pfeiffer
>            Priority: Major
>
> When using a custom settings.xml or repositories configured in the pom, we 
> should make sure to honor this and only ever contact these repositories for 
> dependencies.
> See this output where certain repositories even those found in transitive 
> dependencies are contacted. Not only does this lead to lots of unneeded 
> requests, it also leaks groupIds and artifactIds to these servers.
> {code}
> 11:57:20.026 [DEBUG] Failure to find 
> com.example:myartifact:1.19.0-SNAPSHOT/maven-metadata.xml in 
> https://maven.java.net/content/repositories/snapshots was cached in the local 
> repository, resolution will not be reattempted until the update interval of 
> jvnet-nexus-snapshots has elapsed or updates are forced
> 11:57:20.028 [DEBUG] Failure to find 
> com.example:myartifact:1.19.0-SNAPSHOT/maven-metadata.xml in 
> https://repository.jboss.org/nexus/content/repositories/public/ was cached in 
> the local repository, resolution will not be reattempted until the update 
> interval of JBOSS has elapsed or updates are forced
> 11:57:20.031 [DEBUG] Failure to find 
> com.example:myartifact:1.19.0-SNAPSHOT/maven-metadata.xml in 
> https://oss.sonatype.org/content/repositories/snapshots was cached in the 
> local repository, resolution will not be reattempted until the update 
> interval of sonatype-nexus-snapshots has elapsed or updates are forced
> 11:57:20.033 [DEBUG] Failure to find 
> com.example:myartifact:1.19.0-SNAPSHOT/maven-metadata.xml in 
> https://oss.sonatype.org/content/repositories/snapshots was cached in the 
> local repository, resolution will not be reattempted until the update 
> interval of snapshots-repo has elapsed or updates are forced
> 11:57:20.036 [DEBUG] Failure to find 
> com.example:myartifact:1.19.0-SNAPSHOT/maven-metadata.xml in 
> https://oss.sonatype.org/content/repositories/releases was cached in the 
> local repository, resolution will not be reattempted until the update 
> interval of sonatype-releases has elapsed or updates are forced
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to