2

I know that there are few questions already about dependency:purge-local-repository to clean up the local repository dependency cache.

Almost all posts say this command will remove all dependencies but it seems not... Especially "test" scope dependencies remain and I can't clean up the local repo.

I debugged this plugin a bit and why this happens. Then eventually I found that the getFilteredResolvedArtifacts method in the PurgeLocalRepositoryMojo calls MavenSession.getProjectBuildingRequest() method and this ProjectBuildingRequest has an exclude for test & provided scopes in the buildingRequest.repositorySession.dependencySelector

Source => https://github.com/apache/maven-dependency-plugin/blob/528a2f9b6683ada0b2cabad8593cd814fd08a1b2/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java#L578-L580

Screenshot of debugging => debug screenshot

I would like to know if this plugin intentionally excludes test dependencies to purge (if so, the reason as well..) I wanted to rise a github issue for that (https://github.com/apache/maven-dependency-plugin) but I couldn't find issue page there.

Thanks a lot for the support in advance!

0 Answers0