license-maven-plugin icon indicating copy to clipboard operation
license-maven-plugin copied to clipboard

'download licenses' goals do not exclude transitive dependencies

Open attilapuskas opened this issue 2 years ago • 0 comments

When using any kind of exclusion configuration, like artifactFiltersUrl, excludedGroups or excludedArtifacts, then the excludeTransitiveDependencies does not work.

I think the reason is that the following two lines: https://github.com/mojohaus/license-maven-plugin/blob/4736bf622dec0ce2aea88b60f38d354dfc8b0f27/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java#L219 https://github.com/mojohaus/license-maven-plugin/blob/4736bf622dec0ce2aea88b60f38d354dfc8b0f27/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java#L142 do not use MojoHelper.getArtifactId.

This LicensedArtifactResolver.java is pretty much a copy paste variant of the DependenciesTool.java, where the MojoHelper is added as expected. https://github.com/mojohaus/license-maven-plugin/blob/4736bf622dec0ce2aea88b60f38d354dfc8b0f27/src/main/java/org/codehaus/mojo/license/api/DependenciesTool.java#L239

Therefore all goals affected by LicensedArtifactResolver (download-licenses, aggregate-download-licenses & licenses-xml-insert-versions) are broken regarding the excludeTransitiveDependencies setting, while the ones using DependenciesTool are ok.

attilapuskas avatar Sep 23 '21 10:09 attilapuskas