cstamas commented on code in PR #133:
URL: https://github.com/apache/maven-doap-plugin/pull/133#discussion_r2616468083
##########
src/main/java/org/apache/maven/plugin/doap/DoapMojo.java:
##########
@@ -1381,6 +1392,42 @@ 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
+ // TODO: do we need to handle authentication/proxies here?
+ RemoteRepository aetherRemoteRepository = new RemoteRepository.Builder(
+ repository.getId(), repository.getLayout().getId(),
repository.getUrl())
+ .build();
+
+ ArtifactRequest artifactRequest = new ArtifactRequest();
+ artifactRequest.setArtifact(aetherArtifact);
Review Comment:
If you set file on artifact, Resolver will perform "existence check" only on
remote:
https://github.com/apache/maven-resolver/blob/5b46366f8bfcb8cb40f935907648f7c41141d472/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultArtifactResolver.java#L526-L537
So hint, maybe use LRM to lookup (if it is present locally) and set it here?
Unsure about the use case, but resolving will download the whole artifact.
If really interested in "remote existence" only, you may go deeper and use
connector to issue targeted existence check `ArtifactDownload` requests instead.
--
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]