Johannes Dorn wrote:
In the future, it would be great to have a
dedicated API functionality for this.
Sure, but for any such API to be of actual value, I need to
understand
the underlying use case first, hence my question.
We need this, as we are constantly creating
new artifacts, as well as replace existing ones.
We do some complex calculations that create new artifacts, but in
case one already exists, we want to skip this.
Could you elaborate some more on this process, especially the part
about
replacing artifacts which I assume is the reason why you want to check
etags for outdated artifacts.
We are also checking repositories for
transitive closures, whether all (transitive) dependencies can be
resolved as this is important for our business logic.
Out of curiosity, does this closure check also include existence
checks
for metadata which would be required to resolve version ranges?
Benjamin
_______________________________________________
aether-users mailing list
aether-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aether-users
Hi again,
for now
i've solved this by querying the lucene index of the repository.
This
works reasonably well.
In the future, it would be great to have a
dedicated API functionality for this.
We need this, as we are
constantly creating new artifacts, as well as replace existing ones.
We
do some complex calculations that create new artifacts, but in case one
already exists, we want to skip this.
Related to that we'd also
like to check the etag for existing artifacts to see, whether they are
outdated and need to be replaced.
We are also checking
repositories for transitive closures, whether all (transitive)
dependencies can be resolved as this is important for our business
logic.
Here we also need an existence check, so we can advise our
users which artifacts he needs to place in the repository.
thanks
again
Johannes
Johannes Dorn wrote:
I would like to be able to check the
existence of artifacts in repositories.
[...]
I've tried it with this snippet:
ArtifactDescriptorRequest request = new
ArtifactDescriptorRequest(coordinate, repos, new
NullProgressMonitor());
ArtifactDescriptorResult readArtifactDescriptor =
repositorySystem.readArtifactDescriptor(session, request);
Also keep in mind that the existence of an artifact descriptor
doesn't
say much about the actual artifact. For instance, some Sun/Oracle
artifacts have only POMs in central but no JARs.
Is there a way to ask a repository about the
existence of an artifact?
Yes, but it requires you to reach out to a RepositoryConnector
directly.
Assuming you use org.sonatype.aether.*, you need to get hold of
org.sonatype.aether.impl.RemoteRepositoryManager via dependency
injection etc., call getRepositoryConnector() for each remote repository
in question, and call RepositoryConnector.get() (and close()) for the
artifacts to check for. The ArtifactDownload objects to pass in have a
mutator called setExistenceCheck(), that's what you want.
May I ask what the use case behind all these checks is?
Benjamin
_______________________________________________
aether-users mailing list
aether-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aether-users
Hi,
I would like to
be able to check the existence of artifacts in repositories.
Here
are two examples i need the check to be able to do:
1.
Artifact's pom specifies a non-existent repository and the artifact .jar
was manually placed next to it. Then the check should return true.
2.
If artifact exists in local cache but not in the questioned (remote)
repository, check should return false.
I've tried it with
this snippet:
ArtifactDescriptorRequest request = new
ArtifactDescriptorRequest(coordinate, repos, new NullProgressMonitor());
ArtifactDescriptorResult readArtifactDescriptor =
repositorySystem.readArtifactDescriptor(session, request);
ArtifactRepository repository = readArtifactDescriptor.getRepository();
return repository != null;
but this doesn't work with the first
example.
The other way i've tried is to try and resolve the
artifact and return false if there is an ArtifactResolutionException.
This
doesn't work with the second example(which wouldn't be too bad) but
also downloads every existing artifact. This is bad, since the check is
performed on a potentially huge number of artifacts on remote
repositories.
Is there a way to ask a repository about the
existence of an artifact?
Thanks
Johannes