in artifactregistry-maven-wagon/src/main/java/com/google/cloud/artifactregistry/wagon/ArtifactRegistryWagon.java [100:115]
public boolean resourceExists(String resource)
throws TransferFailedException, AuthorizationException {
try {
GenericUrl url = googleRepository.constructURL(resource);
HttpRequest request = requestFactory.buildHeadRequest(url);
return request.execute().isSuccessStatusCode();
} catch (HttpResponseException e) {
if (e.getStatusCode() == HttpStatusCodes.STATUS_CODE_NOT_FOUND) {
return false;
}
rethrowAuthorizationException(e);
throw new TransferFailedException("Received an error from the remote server.", e);
} catch (IOException e) {
throw new TransferFailedException("Failed to send request to remote server.", e);
}
}