cstamas commented on code in PR #133:
URL: https://github.com/apache/maven-doap-plugin/pull/133#discussion_r2616522946


##########
src/main/java/org/apache/maven/plugin/doap/DoapMojo.java:
##########
@@ -1381,6 +1392,41 @@ private void writeReleases(XMLWriter writer, 
MavenProject project) throws MojoEx
         }
     }
 
+    private boolean isArtifactInRepository(Artifact artifact, 
ArtifactRepository repository) {
+        // Convert Legacy Artifact to Aether Artifact
+        String artifactCoordinates = String.format(
+                "%s:%s:%s:%s",
+                artifact.getGroupId(), artifact.getArtifactId(), 
artifact.getType(), artifact.getVersion());
+
+        org.eclipse.aether.artifact.Artifact aetherArtifact =
+                new 
org.eclipse.aether.artifact.DefaultArtifact(artifactCoordinates);
+
+        // Convert Legacy ArtifactRepository to Aether RemoteRepository
+        RemoteRepository aetherRemoteRepository = new RemoteRepository.Builder(
+                        repository.getId(), repository.getLayout().getId(), 
repository.getUrl())
+                .build();
+
+        ArtifactRequest artifactRequest = new ArtifactRequest();
+        artifactRequest.setArtifact(aetherArtifact);
+
+        // Limit resolution to ONLY the target remote repository
+        
artifactRequest.setRepositories(Collections.singletonList(aetherRemoteRepository));

Review Comment:
   Note: method receives a list of (bare) remote reposes and returns a list of 
remote reposes ready to be used. The ~arity~ numberosity (?) of input param and 
returned list is not same (ie. you may have `mirrorOf:*` in your settings, and 
that would mean that no matter how many bare reposes you pass in, you get that 
one mirror "of all" as output).



##########
src/main/java/org/apache/maven/plugin/doap/DoapMojo.java:
##########
@@ -1381,6 +1392,41 @@ private void writeReleases(XMLWriter writer, 
MavenProject project) throws MojoEx
         }
     }
 
+    private boolean isArtifactInRepository(Artifact artifact, 
ArtifactRepository repository) {
+        // Convert Legacy Artifact to Aether Artifact
+        String artifactCoordinates = String.format(
+                "%s:%s:%s:%s",
+                artifact.getGroupId(), artifact.getArtifactId(), 
artifact.getType(), artifact.getVersion());
+
+        org.eclipse.aether.artifact.Artifact aetherArtifact =
+                new 
org.eclipse.aether.artifact.DefaultArtifact(artifactCoordinates);
+
+        // Convert Legacy ArtifactRepository to Aether RemoteRepository
+        RemoteRepository aetherRemoteRepository = new RemoteRepository.Builder(
+                        repository.getId(), repository.getLayout().getId(), 
repository.getUrl())
+                .build();
+
+        ArtifactRequest artifactRequest = new ArtifactRequest();
+        artifactRequest.setArtifact(aetherArtifact);
+
+        // Limit resolution to ONLY the target remote repository
+        
artifactRequest.setRepositories(Collections.singletonList(aetherRemoteRepository));

Review Comment:
   Note: method receives a list of (bare) remote reposes and returns a list of 
remote reposes ready to be used. The ~arity~ numerosity (?) of input param and 
returned list is not same (ie. you may have `mirrorOf:*` in your settings, and 
that would mean that no matter how many bare reposes you pass in, you get that 
one mirror "of all" as output).



-- 
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