How to test the existence of an artifact before publishing?

Hi,
We are developing a process to publish artifacts on a regular basis for integration testing. For this, I would like to ensure that publishing an artifact does not overwrite an existing one, with the same version.
So I would like to check whether an artifact with a specific name and version is present at a specific URL.
Another apllication could also be to find the next available minor number to publish the current sources.
I think that the API provides the required features but I did not find the entry point for it.

Thanks,
Loïc.

Look for Gradle Artifact resolution query.

Hi François,
Thanks for your quick answer.
This is a part of the solution I am seeking for. This way, I can check artifacts in the repositories my build depends on. But I am not sure that the DependencyHandler includes the repositories defined in the “publish” configuration. Can you confirm this ?
If the default DependencyHandler cannot be used, what would be the most efficient way to create a request on the repository defined in the “publish” configuration ?

Regards,
Loïc.

“But I am not sure that the DependencyHandler includes the repositories defined in the “publish” configuration.”

True. Dependencies are looked on the repo from the project’s repositories block.
The publish block has its own repositories container.

By looking deeply into it, I’m not sure that you can achieve what you want right now.

Ok, I’ll try some workarounds and will post in the forum if I can find
something valuable.

One suggestion I would like to do is that it would be useful to have an
option to not overwrite existing artifacts during “publish”. I don’t
know whether this is the right forum for this.

Thanks for the inputs.

Loïc.