[
https://issues.apache.org/jira/browse/MDEP-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16802242#comment-16802242
]
Robert Kleinschmager commented on MDEP-631:
-------------------------------------------
I have debugged the problem down to it's source, but failed for now, to solve
it.
So I would like to describe my current findings:
Find attached an integration test, which confirms the problem:
[^MDEP-631-its.patch]
The problem can be nailed to
[maven-resolver-impl-1.1.1:DefaultDependencyCollector.java#L375|https://github.com/apache/maven-resolver/blob/maven-resolver-1.1.1/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java#L375]
(I found maven-artifact-transfer-0.11.0 and maven-resolver-impl-1.1.1 on the
classpath). There an {{DependencySelector}} is decinding, that the _pprovided_
dependency can be skipped. This {{DependencySelector}} is configured to skip
all dependencies with scope _test_ and _provided_ (see attached
[^MDEP-631-problemsource-stracktrace.png] ). Following the stacktrace (see
attached [^MDEP-631-problemsource-stracktrace.png] ) shows, that this
{{DependencySelector}} is directly coming from the {{RepositorySystemSession}}
which is taken at
[PurgeLocalRepositoryMojo.java#L576|https://github.com/apache/maven-dependency-plugin/blob/maven-dependency-plugin-3.1.1/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java#L576].
As most of the code lies within _maven-artifact-transfer_ or _maven-resolver_,
we have small chances to do something. One idea, which came into my mind was,
to provide an independent, but fully loaded {{RepositorySystemSession}} with a
different {{DependencySelector}} instance. This idea failed, as
{{DependencySelector}} is not directly on the classpath and [~khmarbaise] and
[~rfscholte] confirmed, that solution would not be easy.
> purge-local-repository doesn't include dependencies with scope provided
> -----------------------------------------------------------------------
>
> Key: MDEP-631
> URL: https://issues.apache.org/jira/browse/MDEP-631
> Project: Maven Dependency Plugin
> Issue Type: New Feature
> Components: purge-local-repository
> Affects Versions: 3.1.1
> Reporter: Benjamin Donze
> Priority: Major
> Labels: up-for-grabs
> Attachments: MDEP-631-its.patch,
> MDEP-631-problemsource-stracktrace.png, MDEP-631-problemsource-variables.png
>
>
> When configuring a goal using purge-local-repository within a pom file the
> dependencies with of the module with scope provided are not purged from local
> repository.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)