[java-mvn-enforcer] 03/03: JMVN-90 Troubleshoot Maven artifact resolution errors
Codeberg
noreply at shibboleth.net
Thu Oct 8 13:23:24 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-mvn-enforcer.
View the commit online:
https://codeberg.org/Shibboleth/java-mvn-enforcer/commit/787abdd9d6aaee324512e42dee38cb0983908726
commit 787abdd9d6aaee324512e42dee38cb0983908726
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Oct 8 14:15:03 2026 +0100
JMVN-90 Troubleshoot Maven artifact resolution errors
https://shibboleth.atlassian.net/browse/JMVN-90
Add extended logging and limited retry for artifact resolution
---
.../shibboleth/mvn/enforcer/impl/JarEnforcer.java | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java b/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java
index 47ac73d..6847d02 100644
--- a/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java
+++ b/src/main/java/net/shibboleth/mvn/enforcer/impl/JarEnforcer.java
@@ -498,14 +498,20 @@ public class JarEnforcer extends AbstractEnforcerRule implements MavenLoader{
final Artifact artifact = new DefaultArtifact(groupId, artifactId, classifier, type, version);
final ArtifactRequest req = new ArtifactRequest(artifact, project.getRemoteProjectRepositories(), null);
- log.debug("Resolving ", artifact);
- try {
- final ArtifactResult res = repositorySystem.resolveArtifact(session.getRepositorySession(), req);
- final File file = res.getArtifact().getFile();
- log.debug("Resolved to ", file.getAbsolutePath());
- return file;
- } catch (final ArtifactResolutionException e) {
- log.error("Resolution failed", e);
+ int retryCount = 0;
+ log.debug("Resolving {}", artifact);
+ while(true) {
+ try {
+ final ArtifactResult res = repositorySystem.resolveArtifact(session.getRepositorySession(), req);
+ final File file = res.getArtifact().getFile();
+ log.debug("Resolved to {}", file.getAbsolutePath());
+ return file;
+ } catch (final ArtifactResolutionException e) {
+ log.error("Resolution of {} failed {} {} \n {}", artifact, e.getMessage(), e.getCause(), e.getStackTrace());
+ if (retryCount++ > 1) {
+ break;
+ }
+ }
}
return null;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list