GitHub user jhaber opened a pull request:
https://github.com/apache/maven-shared/pull/21
[MSHARED-632] Expose which dependency classes are used and where
We use the maven-dependency-plugin to analyze dependencies and fail our
build if there are any used undeclared or unused declared dependencies. In the
case of used undeclared dependencies, it is often helpful to know which classes
are being used and where they are being used. We've found a few workarounds to
make this a little easier, but the plugin has access to this information so
what we really want is for the plugin to just print this info along with each
used undeclared dependency. We've made this change in our fork and our
developers are very happy with it, so I'd like to contribute it back
([here](https://gist.github.com/jhaber/d8204829fe61569e0034250df74300fb) is an
example of the output before and after the change).
If you agree this is a useful feature, this PR implements the first step
which is to update the maven-dependency-analyzer to return this information so
that the maven-dependency-plugin can use it.
I introduced a new interface, `DependencyAnalyzerWithUsages`, to avoid
breaking changes to the `DependencyAnalyzer` interface. I confirmed with the
japi-compliance-checker that source and binary compatibility has been
maintained:
```
â ~ perl japi-compliance-checker.pl -lib maven-dependency-analyzer
-jdk-path $JAVA7_HOME -old ~/Downloads/maven-dependency-analyzer-1.6.jar -new
~/src/maven-shared-pr/maven-dependency-analyzer/target/maven-dependency-analyzer-1.7-SNAPSHOT.jar
using Java 1.7.0_75
WARNING: set 1st version number to 1.6 (use -v1 option to change it)
WARNING: set 2nd version number to 1.7-SNAPSHOT (use -v2 option to change
it)
reading classes 1.6 ...
reading classes 1.7-SNAPSHOT ...
comparing classes ...
creating compatibility report ...
result: COMPATIBLE
total "Binary" compatibility problems: 0, warnings: 0
total "Source" compatibility problems: 0, warnings: 0
see detailed report:
compat_reports/maven-dependency-analyzer/1.6_to_1.7-SNAPSHOT/compat_report.html
```
I'd love to hear any thoughts or feedback you have, thanks!
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jhaber/maven-shared trunk
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/maven-shared/pull/21.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #21
----
commit 578043a6dbf3927491aa01b00497b194ec471ebd
Author: Jonathan Haber <[email protected]>
Date: 2017-04-21T03:41:32Z
Expose which dependency classes are used and where
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]