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

[MDEP-916] Maven Dependency Plugin: Inclusion of main artifact in the output report

Open jira-importer opened this issue 1 year ago • 1 comments

Arnab Banerjee opened MDEP-916 and commented

While using Apache Maven Dependency Plugin and using dependency:list, I noticed that the main artifact, which is being analyzed, is NOT getting included in the output report. It would be great to have an user property for the plugin to include the main artifact as well in the report.   Following is an example for dependency listing of org.apache.httpcomponents.client5:httpclient5   [INFO] -----------< org.apache.httpcomponents.client5:httpclient5 >------------ [INFO] Building Apache HttpClient 5.4-alpha3-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-dependency-plugin:3.3.0:list (default-cli) @ httpclient5 --- [INFO] [INFO] The following files have been resolved: [INFO]    org.apache.httpcomponents.core5:httpcore5:jar:5.3-alpha2:compile -- module org.apache.httpcomponents.core5.httpcore5 [auto] [INFO]    org.apache.httpcomponents.core5:httpcore5-h2:jar:5.3-alpha2:compile -- module org.apache.httpcomponents.core5.httpcore5.h2 [auto] [INFO]    org.slf4j:slf4j-api:jar:1.7.36:compile -- module org.slf4j [auto] [INFO]    org.conscrypt:conscrypt-openjdk-uber:jar:2.5.2:compile (optional) -- module org.conscrypt [auto] [INFO]    org.apache.httpcomponents.core5:httpcore5-reactive:jar:5.3-alpha2:test -- module org.apache.httpcomponents.core5.httpcore5.reactive [auto] [INFO]    org.reactivestreams:reactive-streams:jar:1.0.4:test -- module org.reactivestreams [auto] [INFO]    io.reactivex.rxjava2:rxjava:jar:2.2.21:test -- module io.reactivex.rxjava2 [auto] [INFO]    org.apache.logging.log4j:log4j-slf4j-impl:jar:2.23.0:test -- module org.apache.logging.log4j.slf4j.impl [INFO]    org.apache.logging.log4j:log4j-api:jar:2.23.0:test -- module org.apache.logging.log4j [INFO]    org.apache.logging.log4j:log4j-core:jar:2.23.0:test -- module org.apache.logging.log4j.core [INFO]    org.brotli:dec:jar:0.1.2:compile (optional) -- module dec (auto) [INFO]    org.junit.jupiter:junit-jupiter:jar:5.10.2:test -- module org.junit.jupiter [INFO]    org.junit.jupiter:junit-jupiter-api:jar:5.10.2:test -- module org.junit.jupiter.api [INFO]    org.opentest4j:opentest4j:jar:1.3.0:test -- module org.opentest4j [INFO]    org.junit.platform:junit-platform-commons:jar:1.10.2:test -- module org.junit.platform.commons [INFO]    org.apiguardian:apiguardian-api:jar:1.1.2:test -- module org.apiguardian.api [INFO]    org.junit.jupiter:junit-jupiter-params:jar:5.10.2:test -- module org.junit.jupiter.params [INFO]    org.junit.jupiter:junit-jupiter-engine:jar:5.10.2:test -- module org.junit.jupiter.engine [INFO]    org.junit.platform:junit-platform-engine:jar:1.10.2:test -- module org.junit.platform.engine [INFO]    org.hamcrest:hamcrest:jar:2.2:test -- module org.hamcrest [auto] [INFO]    org.mockito:mockito-core:jar:4.11.0:test -- module org.mockito [auto] [INFO]    net.bytebuddy:byte-buddy:jar:1.12.19:test -- module net.bytebuddy [INFO]    net.bytebuddy:byte-buddy-agent:jar:1.12.19:test -- module net.bytebuddy.agent [INFO]    org.objenesis:objenesis:jar:3.3:test -- module org.objenesis [auto] [INFO]   Expected behavior: We should be able to include "org.apache.httpcomponents.client5:httpclient5" as well as part of the output for reporting/automation purposes.  Probably similar to <includeParents> we can have an option like: "includeSelf"   Note: dependency:tree goal gives us complete output.


Affects: 3.6.1

jira-importer avatar Apr 11 '24 18:04 jira-importer

Tamas Cservenak commented

This is chicken or egg problem: maven should know is "main artifact being analyzed" built at all, as otherwise it cannot be analyzed (what to analyze?). Ideally, the main artifact should be installed. But if installed, you have alternate means to perform this: example is here

https://gist.github.com/cstamas/9b4b6464978a3d4313268dbf30ad55b7

jira-importer avatar Apr 11 '24 20:04 jira-importer