[jira] [Commented] (MNG-6732) DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon ArtifactTransferException

2023-04-23 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-6732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17715476#comment-17715476
 ] 

Michael Osipov commented on MNG-6732:
-

[~sjaranowski], this is related to the issue where the 
{{ArtifactNotFoundException}} is deceiving.

> DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon 
> ArtifactTransferException
> -
>
> Key: MNG-6732
> URL: https://issues.apache.org/jira/browse/MNG-6732
> Project: Maven
>  Issue Type: Improvement
>  Components: Core
>Affects Versions: 3.6.1
>Reporter: Tomo Suzuki
>Priority: Major
> Fix For: 4.0.x-candidate
>
> Attachments: 62884438-89260580-bd04-11e9-8c4a-897d4b736dc7.png
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> h1. Problem
> Sometimes [Linkage Checker enforcer 
> rule|https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/enforcer-rules]
>  does not receive resolved artifact list because of a missing artifact even 
> when the missing artifact is unused after Maven's dependency mediation.
> h1. Background
> The enforcer rule fails to retrieve artifact list through 
> {{DefaultProjectDependenciesResolver.resolve}} when applied to 
> [grpc-java-by-example/chat-example/chat-vaadin-client|https://github.com/saturnism/grpc-java-by-example/tree/master/chat-example/chat-vaadin-client]
>  because of the missing {{xerces:xerces-impl:2.6.2}}, even though the 
> artifact does not appear in the final dependency graph. The artifact does not 
> appear in the graph because of Maven's dependency mediation.
> Artifact xerces:xerces-impl:2.6.2 is not published in Maven Central.
> In contrast, the enforcer rule can retrieve artifact list when applied to 
> [https://github.com/suztomo/spring-cloud-gcp/tree/v1.1.2-linkage-checker] 
> project even though it outputs "[WARNING] The POM for 
> xerces:xerces-impl:jar:2.6.2 is missing, no dependency information 
> available". The missing artifact does not appear in final dependency graph.
> [https://github.com/GoogleCloudPlatform/cloud-opensource-java/issues/834]
> h1. Diagnosis
> Currently {{DefaultArtifactDescriptorReader.loadPom}} method checks 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy upon 
> ArtifactNotFoundException. This allows 
> {{DefaultProjectDependenciesResolver.resolve}} calls 
> {{repoSystem.resolveDependencies}} to obtain partially resolved artifact 
> list, rather than failing entirely, when there is a missing artifact (such as 
> {{xerces:xerces-impl:2.6.2}})
> However, when a retired Maven repository is involved (such as 
> [http://repository.codehaus.org/] ), 
> {{DefaultArtifactDescriptorReader.loadPom}} gets an ArtifactTransferException 
> and throws ArtifactDescriptorException without checking 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy (excerpt below), and thus 
> {{DefaultProjectDependenciesResolver.resolve}} does not return partially 
> resolved artifact list.
> {code:java}
> catch ( ArtifactResolutionException e )
> {
> if ( e.getCause() instanceof ArtifactNotFoundException )
> {
> missingDescriptor( session, trace, a, (Exception) 
> e.getCause() );
> if ( ( getPolicy( session, a, request ) & 
> ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
> {
> return null;
> }
> }
> result.addException( e );
> throw new ArtifactDescriptorException( result );
> }
> {code}
> from 
> [DefaultArtifactDescriptorReader.java|https://github.com/apache/maven/blob/d3ace78/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java#L255]
> ArtifactNotFoundException is a special case of 
> [ArtifactTransferException|https://maven.apache.org/resolver/apidocs/org/eclipse/aether/transfer/ArtifactTransferException.html].
> h1. Example Project
> Example project to demonstrate the diagnosis: 
> [https://github.com/suztomo/maven-missing-artifact] . In this example, even 
> though module-b and module-c have the same dependency section, module-c fails 
> to run Maven because of a repository section containing a retired repository 
> URL.



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


[jira] [Commented] (MNG-6732) DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon ArtifactTransferException

2023-04-09 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-6732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17709984#comment-17709984
 ] 

Michael Osipov commented on MNG-6732:
-

I finally do understand this issue now because due to another case I 
intensively analyzed it. Me and [~cstamas] know the problem now and will work 
on a reasonable soluton.

> DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon 
> ArtifactTransferException
> -
>
> Key: MNG-6732
> URL: https://issues.apache.org/jira/browse/MNG-6732
> Project: Maven
>  Issue Type: Improvement
>  Components: Core
>Affects Versions: 3.6.1
>Reporter: Tomo Suzuki
>Priority: Major
> Fix For: 4.0.x-candidate
>
> Attachments: 62884438-89260580-bd04-11e9-8c4a-897d4b736dc7.png
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> h1. Problem
> Sometimes [Linkage Checker enforcer 
> rule|https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/enforcer-rules]
>  does not receive resolved artifact list because of a missing artifact even 
> when the missing artifact is unused after Maven's dependency mediation.
> h1. Background
> The enforcer rule fails to retrieve artifact list through 
> {{DefaultProjectDependenciesResolver.resolve}} when applied to 
> [grpc-java-by-example/chat-example/chat-vaadin-client|https://github.com/saturnism/grpc-java-by-example/tree/master/chat-example/chat-vaadin-client]
>  because of the missing {{xerces:xerces-impl:2.6.2}}, even though the 
> artifact does not appear in the final dependency graph. The artifact does not 
> appear in the graph because of Maven's dependency mediation.
> Artifact xerces:xerces-impl:2.6.2 is not published in Maven Central.
> In contrast, the enforcer rule can retrieve artifact list when applied to 
> [https://github.com/suztomo/spring-cloud-gcp/tree/v1.1.2-linkage-checker] 
> project even though it outputs "[WARNING] The POM for 
> xerces:xerces-impl:jar:2.6.2 is missing, no dependency information 
> available". The missing artifact does not appear in final dependency graph.
> [https://github.com/GoogleCloudPlatform/cloud-opensource-java/issues/834]
> h1. Diagnosis
> Currently {{DefaultArtifactDescriptorReader.loadPom}} method checks 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy upon 
> ArtifactNotFoundException. This allows 
> {{DefaultProjectDependenciesResolver.resolve}} calls 
> {{repoSystem.resolveDependencies}} to obtain partially resolved artifact 
> list, rather than failing entirely, when there is a missing artifact (such as 
> {{xerces:xerces-impl:2.6.2}})
> However, when a retired Maven repository is involved (such as 
> [http://repository.codehaus.org/] ), 
> {{DefaultArtifactDescriptorReader.loadPom}} gets an ArtifactTransferException 
> and throws ArtifactDescriptorException without checking 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy (excerpt below), and thus 
> {{DefaultProjectDependenciesResolver.resolve}} does not return partially 
> resolved artifact list.
> {code:java}
> catch ( ArtifactResolutionException e )
> {
> if ( e.getCause() instanceof ArtifactNotFoundException )
> {
> missingDescriptor( session, trace, a, (Exception) 
> e.getCause() );
> if ( ( getPolicy( session, a, request ) & 
> ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
> {
> return null;
> }
> }
> result.addException( e );
> throw new ArtifactDescriptorException( result );
> }
> {code}
> from 
> [DefaultArtifactDescriptorReader.java|https://github.com/apache/maven/blob/d3ace78/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java#L255]
> ArtifactNotFoundException is a special case of 
> [ArtifactTransferException|https://maven.apache.org/resolver/apidocs/org/eclipse/aether/transfer/ArtifactTransferException.html].
> h1. Example Project
> Example project to demonstrate the diagnosis: 
> [https://github.com/suztomo/maven-missing-artifact] . In this example, even 
> though module-b and module-c have the same dependency section, module-c fails 
> to run Maven because of a repository section containing a retired repository 
> URL.



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


[jira] [Commented] (MNG-6732) DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon ArtifactTransferException

2020-01-22 Thread Tomo Suzuki (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-6732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17021433#comment-17021433
 ] 

Tomo Suzuki commented on MNG-6732:
--

Now PR is to special-case UnknownHostException. Running 
maven-integration-testing.

> DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon 
> ArtifactTransferException
> -
>
> Key: MNG-6732
> URL: https://issues.apache.org/jira/browse/MNG-6732
> Project: Maven
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 3.6.1
>Reporter: Tomo Suzuki
>Assignee: Michael Osipov
>Priority: Major
> Fix For: 3.7.0-candidate
>
> Attachments: 62884438-89260580-bd04-11e9-8c4a-897d4b736dc7.png
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> h1. Problem
> Sometimes [Linkage Checker enforcer 
> rule|https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/enforcer-rules]
>  does not receive resolved artifact list because of a missing artifact even 
> when the missing artifact is unused after Maven's dependency mediation.
> h1. Background
> The enforcer rule fails to retrieve artifact list through 
> {{DefaultProjectDependenciesResolver.resolve}} when applied to 
> [grpc-java-by-example/chat-example/chat-vaadin-client|https://github.com/saturnism/grpc-java-by-example/tree/master/chat-example/chat-vaadin-client]
>  because of the missing {{xerces:xerces-impl:2.6.2}}, even though the 
> artifact does not appear in the final dependency graph. The artifact does not 
> appear in the graph because of Maven's dependency mediation.
> Artifact xerces:xerces-impl:2.6.2 is not published in Maven Central.
> In contrast, the enforcer rule can retrieve artifact list when applied to 
> [https://github.com/suztomo/spring-cloud-gcp/tree/v1.1.2-linkage-checker] 
> project even though it outputs "[WARNING] The POM for 
> xerces:xerces-impl:jar:2.6.2 is missing, no dependency information 
> available". The missing artifact does not appear in final dependency graph.
> [https://github.com/GoogleCloudPlatform/cloud-opensource-java/issues/834]
> h1. Diagnosis
> Currently {{DefaultArtifactDescriptorReader.loadPom}} method checks 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy upon 
> ArtifactNotFoundException. This allows 
> {{DefaultProjectDependenciesResolver.resolve}} calls 
> {{repoSystem.resolveDependencies}} to obtain partially resolved artifact 
> list, rather than failing entirely, when there is a missing artifact (such as 
> {{xerces:xerces-impl:2.6.2}})
> However, when a retired Maven repository is involved (such as 
> [http://repository.codehaus.org/] ), 
> {{DefaultArtifactDescriptorReader.loadPom}} gets an ArtifactTransferException 
> and throws ArtifactDescriptorException without checking 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy (excerpt below), and thus 
> {{DefaultProjectDependenciesResolver.resolve}} does not return partially 
> resolved artifact list.
> {code:java}
> catch ( ArtifactResolutionException e )
> {
> if ( e.getCause() instanceof ArtifactNotFoundException )
> {
> missingDescriptor( session, trace, a, (Exception) 
> e.getCause() );
> if ( ( getPolicy( session, a, request ) & 
> ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
> {
> return null;
> }
> }
> result.addException( e );
> throw new ArtifactDescriptorException( result );
> }
> {code}
> from 
> [DefaultArtifactDescriptorReader.java|https://github.com/apache/maven/blob/d3ace78/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java#L255]
> ArtifactNotFoundException is a special case of 
> [ArtifactTransferException|https://maven.apache.org/resolver/apidocs/org/eclipse/aether/transfer/ArtifactTransferException.html].
> h1. Example Project
> Example project to demonstrate the diagnosis: 
> [https://github.com/suztomo/maven-missing-artifact] . In this example, even 
> though module-b and module-c have the same dependency section, module-c fails 
> to run Maven because of a repository section containing a retired repository 
> URL.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-6732) DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon ArtifactTransferException

2020-01-22 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-6732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17021384#comment-17021384
 ] 

Michael Osipov commented on MNG-6732:
-

Correct.

> DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon 
> ArtifactTransferException
> -
>
> Key: MNG-6732
> URL: https://issues.apache.org/jira/browse/MNG-6732
> Project: Maven
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 3.6.1
>Reporter: Tomo Suzuki
>Assignee: Michael Osipov
>Priority: Major
> Fix For: 3.7.0-candidate
>
> Attachments: 62884438-89260580-bd04-11e9-8c4a-897d4b736dc7.png
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> h1. Problem
> Sometimes [Linkage Checker enforcer 
> rule|https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/enforcer-rules]
>  does not receive resolved artifact list because of a missing artifact even 
> when the missing artifact is unused after Maven's dependency mediation.
> h1. Background
> The enforcer rule fails to retrieve artifact list through 
> {{DefaultProjectDependenciesResolver.resolve}} when applied to 
> [grpc-java-by-example/chat-example/chat-vaadin-client|https://github.com/saturnism/grpc-java-by-example/tree/master/chat-example/chat-vaadin-client]
>  because of the missing {{xerces:xerces-impl:2.6.2}}, even though the 
> artifact does not appear in the final dependency graph. The artifact does not 
> appear in the graph because of Maven's dependency mediation.
> Artifact xerces:xerces-impl:2.6.2 is not published in Maven Central.
> In contrast, the enforcer rule can retrieve artifact list when applied to 
> [https://github.com/suztomo/spring-cloud-gcp/tree/v1.1.2-linkage-checker] 
> project even though it outputs "[WARNING] The POM for 
> xerces:xerces-impl:jar:2.6.2 is missing, no dependency information 
> available". The missing artifact does not appear in final dependency graph.
> [https://github.com/GoogleCloudPlatform/cloud-opensource-java/issues/834]
> h1. Diagnosis
> Currently {{DefaultArtifactDescriptorReader.loadPom}} method checks 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy upon 
> ArtifactNotFoundException. This allows 
> {{DefaultProjectDependenciesResolver.resolve}} calls 
> {{repoSystem.resolveDependencies}} to obtain partially resolved artifact 
> list, rather than failing entirely, when there is a missing artifact (such as 
> {{xerces:xerces-impl:2.6.2}})
> However, when a retired Maven repository is involved (such as 
> [http://repository.codehaus.org/] ), 
> {{DefaultArtifactDescriptorReader.loadPom}} gets an ArtifactTransferException 
> and throws ArtifactDescriptorException without checking 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy (excerpt below), and thus 
> {{DefaultProjectDependenciesResolver.resolve}} does not return partially 
> resolved artifact list.
> {code:java}
> catch ( ArtifactResolutionException e )
> {
> if ( e.getCause() instanceof ArtifactNotFoundException )
> {
> missingDescriptor( session, trace, a, (Exception) 
> e.getCause() );
> if ( ( getPolicy( session, a, request ) & 
> ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
> {
> return null;
> }
> }
> result.addException( e );
> throw new ArtifactDescriptorException( result );
> }
> {code}
> from 
> [DefaultArtifactDescriptorReader.java|https://github.com/apache/maven/blob/d3ace78/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java#L255]
> ArtifactNotFoundException is a special case of 
> [ArtifactTransferException|https://maven.apache.org/resolver/apidocs/org/eclipse/aether/transfer/ArtifactTransferException.html].
> h1. Example Project
> Example project to demonstrate the diagnosis: 
> [https://github.com/suztomo/maven-missing-artifact] . In this example, even 
> though module-b and module-c have the same dependency section, module-c fails 
> to run Maven because of a repository section containing a retired repository 
> URL.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-6732) DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon ArtifactTransferException

2020-01-22 Thread Tomo Suzuki (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-6732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17021268#comment-17021268
 ] 

Tomo Suzuki commented on MNG-6732:
--

Memo:
Investigation on mng-3470 test case failure:

{noformat}
suztomo@suxtomo24:~/maven-integration-testing/core-it-suite/target/test-classes/mng-3470$
 
/usr/local/google/home/suztomo/app/maven/apache-maven-3.7.0-SNAPSHOT/bin/mvnDebug
 validate --settings settings.xml
Preparing to execute Maven in debug mode
Listening for transport dt_socket at address: 8000
{noformat}




> DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon 
> ArtifactTransferException
> -
>
> Key: MNG-6732
> URL: https://issues.apache.org/jira/browse/MNG-6732
> Project: Maven
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 3.6.1
>Reporter: Tomo Suzuki
>Assignee: Michael Osipov
>Priority: Major
> Fix For: 3.7.0-candidate
>
> Attachments: 62884438-89260580-bd04-11e9-8c4a-897d4b736dc7.png
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> h1. Problem
> Sometimes [Linkage Checker enforcer 
> rule|https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/enforcer-rules]
>  does not receive resolved artifact list because of a missing artifact even 
> when the missing artifact is unused after Maven's dependency mediation.
> h1. Background
> The enforcer rule fails to retrieve artifact list through 
> {{DefaultProjectDependenciesResolver.resolve}} when applied to 
> [grpc-java-by-example/chat-example/chat-vaadin-client|https://github.com/saturnism/grpc-java-by-example/tree/master/chat-example/chat-vaadin-client]
>  because of the missing {{xerces:xerces-impl:2.6.2}}, even though the 
> artifact does not appear in the final dependency graph. The artifact does not 
> appear in the graph because of Maven's dependency mediation.
> Artifact xerces:xerces-impl:2.6.2 is not published in Maven Central.
> In contrast, the enforcer rule can retrieve artifact list when applied to 
> [https://github.com/suztomo/spring-cloud-gcp/tree/v1.1.2-linkage-checker] 
> project even though it outputs "[WARNING] The POM for 
> xerces:xerces-impl:jar:2.6.2 is missing, no dependency information 
> available". The missing artifact does not appear in final dependency graph.
> [https://github.com/GoogleCloudPlatform/cloud-opensource-java/issues/834]
> h1. Diagnosis
> Currently {{DefaultArtifactDescriptorReader.loadPom}} method checks 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy upon 
> ArtifactNotFoundException. This allows 
> {{DefaultProjectDependenciesResolver.resolve}} calls 
> {{repoSystem.resolveDependencies}} to obtain partially resolved artifact 
> list, rather than failing entirely, when there is a missing artifact (such as 
> {{xerces:xerces-impl:2.6.2}})
> However, when a retired Maven repository is involved (such as 
> [http://repository.codehaus.org/] ), 
> {{DefaultArtifactDescriptorReader.loadPom}} gets an ArtifactTransferException 
> and throws ArtifactDescriptorException without checking 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy (excerpt below), and thus 
> {{DefaultProjectDependenciesResolver.resolve}} does not return partially 
> resolved artifact list.
> {code:java}
> catch ( ArtifactResolutionException e )
> {
> if ( e.getCause() instanceof ArtifactNotFoundException )
> {
> missingDescriptor( session, trace, a, (Exception) 
> e.getCause() );
> if ( ( getPolicy( session, a, request ) & 
> ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
> {
> return null;
> }
> }
> result.addException( e );
> throw new ArtifactDescriptorException( result );
> }
> {code}
> from 
> [DefaultArtifactDescriptorReader.java|https://github.com/apache/maven/blob/d3ace78/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java#L255]
> ArtifactNotFoundException is a special case of 
> [ArtifactTransferException|https://maven.apache.org/resolver/apidocs/org/eclipse/aether/transfer/ArtifactTransferException.html].
> h1. Example Project
> Example project to demonstrate the diagnosis: 
> [https://github.com/suztomo/maven-missing-artifact] . In this example, even 
> though module-b and module-c have the same dependency section, module-c fails 
> to run Maven because of a repository section containing a retired repository 
> URL.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-6732) DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon ArtifactTransferException

2020-01-16 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-6732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17017533#comment-17017533
 ] 

Michael Osipov commented on MNG-6732:
-

I was able to make your test project run according to the instructions.

> DefaultArtifactDescriptorReader.loadPom to check IGNORE_MISSING policy upon 
> ArtifactTransferException
> -
>
> Key: MNG-6732
> URL: https://issues.apache.org/jira/browse/MNG-6732
> Project: Maven
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 3.6.1
>Reporter: Tomo Suzuki
>Assignee: Michael Osipov
>Priority: Major
> Fix For: 3.7.0-candidate
>
> Attachments: 62884438-89260580-bd04-11e9-8c4a-897d4b736dc7.png
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> h1. Problem
> Sometimes [Linkage Checker enforcer 
> rule|https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/enforcer-rules]
>  does not receive resolved artifact list because of a missing artifact even 
> when the missing artifact is unused after Maven's dependency mediation.
> h1. Background
> The enforcer rule fails to retrieve artifact list through 
> {{DefaultProjectDependenciesResolver.resolve}} when applied to 
> [grpc-java-by-example/chat-example/chat-vaadin-client|https://github.com/saturnism/grpc-java-by-example/tree/master/chat-example/chat-vaadin-client]
>  because of the missing {{xerces:xerces-impl:2.6.2}}, even though the 
> artifact does not appear in the final dependency graph. The artifact does not 
> appear in the graph because of Maven's dependency mediation.
> Artifact xerces:xerces-impl:2.6.2 is not published in Maven Central.
> In contrast, the enforcer rule can retrieve artifact list when applied to 
> [https://github.com/suztomo/spring-cloud-gcp/tree/v1.1.2-linkage-checker] 
> project even though it outputs "[WARNING] The POM for 
> xerces:xerces-impl:jar:2.6.2 is missing, no dependency information 
> available". The missing artifact does not appear in final dependency graph.
> [https://github.com/GoogleCloudPlatform/cloud-opensource-java/issues/834]
> h1. Diagnosis
> Currently {{DefaultArtifactDescriptorReader.loadPom}} method checks 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy upon 
> ArtifactNotFoundException. This allows 
> {{DefaultProjectDependenciesResolver.resolve}} calls 
> {{repoSystem.resolveDependencies}} to obtain partially resolved artifact 
> list, rather than failing entirely, when there is a missing artifact (such as 
> {{xerces:xerces-impl:2.6.2}})
> However, when a retired Maven repository is involved (such as 
> [http://repository.codehaus.org/] ), 
> {{DefaultArtifactDescriptorReader.loadPom}} gets an ArtifactTransferException 
> and throws ArtifactDescriptorException without checking 
> "ArtifactDescriptorPolicy.IGNORE_MISSING" policy (excerpt below), and thus 
> {{DefaultProjectDependenciesResolver.resolve}} does not return partially 
> resolved artifact list.
> {code:java}
> catch ( ArtifactResolutionException e )
> {
> if ( e.getCause() instanceof ArtifactNotFoundException )
> {
> missingDescriptor( session, trace, a, (Exception) 
> e.getCause() );
> if ( ( getPolicy( session, a, request ) & 
> ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
> {
> return null;
> }
> }
> result.addException( e );
> throw new ArtifactDescriptorException( result );
> }
> {code}
> from 
> [DefaultArtifactDescriptorReader.java|https://github.com/apache/maven/blob/d3ace78/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java#L255]
> ArtifactNotFoundException is a special case of 
> [ArtifactTransferException|https://maven.apache.org/resolver/apidocs/org/eclipse/aether/transfer/ArtifactTransferException.html].
> h1. Example Project
> Example project to demonstrate the diagnosis: 
> [https://github.com/suztomo/maven-missing-artifact] . In this example, even 
> though module-b and module-c have the same dependency section, module-c fails 
> to run Maven because of a repository section containing a retired repository 
> URL.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)