Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'download licenses' goals do not exclude transitive dependencies #413

Closed
attilapuskas opened this issue Sep 23, 2021 · 1 comment · Fixed by #414
Closed

'download licenses' goals do not exclude transitive dependencies #413

attilapuskas opened this issue Sep 23, 2021 · 1 comment · Fixed by #414
Labels

Comments

@attilapuskas
Copy link
Contributor

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:


final String id = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();

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.

result.remove( MojoHelper.getArtifactId( entry.getValue() ) );

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.

@axherrm
Copy link

axherrm commented Jun 29, 2023

This seems not to be fixed any time soon...
Is there any sort of workaround?

slawekjaranowski added a commit that referenced this issue Jul 2, 2023
Fixes #413

In the result mapping we need to use "GAV" to be compatible with
the other classes in the plugin. While the exclude/includeArtifacts
should still use the Artifact#getId, since the getDependencyTrail
also uses that format, which is considered when we exclude all the
transitive deps of excluded artifacts.

Note that the added it is based on the already existing
download-licenses-include-exclude-types, but with a small change
in the settings to use excludeTransitiveDependencies instead.

---------

Co-authored-by: Attila Puskas <attila.puskas@casrd.net>
Co-authored-by: Slawomir Jaranowski <s.jaranowski@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants