Ensure localm2 ivy repo can resolve artifacts

Fix the localm2 repository to only consider that a pom exists when
its artifact is contained in the repository.

This prevents a download error that can occur when the local m2
repository contains a POM file but not a JAR.

Issue: #55532358