You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2023/04/09 19:01:00 UTC

[jira] [Commented] (MRESOLVER-335) Better resolver errors for Artifact Not Found

    [ https://issues.apache.org/jira/browse/MRESOLVER-335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17709985#comment-17709985 ] 

Michael Osipov commented on MRESOLVER-335:
------------------------------------------

[~sjaranowski], this needs to be broadened because as depicted in MNG-7758 these two are flawed for me:

{code:java}
    private static Throwable getCause(List<? extends ArtifactResult> results) {
        for (ArtifactResult result : results) {
            if (!result.isResolved()) {
                Throwable notFound = null, offline = null;
                for (Throwable t : result.getExceptions()) {
                    if (t instanceof ArtifactNotFoundException) {
                        if (notFound == null || notFound instanceof ArtifactFilteredOutException) {
                            notFound = t;
                        }
                        if (offline == null && t.getCause() instanceof RepositoryOfflineException) {
                            offline = t;
                        }
                    } else {
                        return t;
                    }
                }
                if (offline != null) {
                    return offline;
                }
                if (notFound != null) {
                    return notFound;
                }
            }
        }
        return null;
    }
{code}
and
{code:java}
    public boolean isMissing() {
        for (Exception e : getExceptions()) {
            if (!(e instanceof ArtifactNotFoundException)) {
                return false;
            }
        }
        return !isResolved();
    }
{noformat}
{code}

> Better resolver errors for Artifact Not Found
> ---------------------------------------------
>
>                 Key: MRESOLVER-335
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-335
>             Project: Maven Resolver
>          Issue Type: Improvement
>          Components: Resolver
>            Reporter: Slawomir Jaranowski
>            Priority: Major
>             Fix For: 1.10.0
>
>
> When we have many remote repositories only first {{ArtifactNotFoundException}} is returned, all checks for other repositories are hidden.
> When we have errors for many artifacts in one request - list of problematic artifacts is present in message and only first exception for one artifact.
> Next case is with remote repository filtering, checks for remote repository according to filtering also produce {{ArtifactNotFoundException}}, this is done at the beginning so exception is first on list.
> In logs and exception we have:
> {code}
> Downloading from my-mirror: https://artifactory.../artifactory/remote-repos/org/apache/commons/commons-lang3/4.4.4/commons-lang3-4.4.4.pom
> [WARNING] The POM for org.apache.commons:commons-lang3:jar:4.4.4 is missing, no dependency information available
> Downloading from my-mirror: https://artifactory.../artifactory/remote-repos/org/apache/commons/commons-lang3/4.4.4/commons-lang3-4.4.4.jar
> [ERROR] Failed to execute goal on project maven-3.9: Could not resolve dependencies for project org.test:maven-3.9:jar:1.0.0-SNAPSHOT: Prefix org NOT allowed from mayrepo (https://artifactory.../artifactory/myrepo/, default, releases+snapshots) 
> {code}
> As we see artefact was not found in {{my-mirror}}, but in error report we have information about not allowed prefixes - it can be confusing



--
This message was sent by Atlassian Jira
(v8.20.10#820010)