[Commented] (MSHARED-632) Expose which dependency classes are used and where

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Commented] (MSHARED-632) Expose which dependency classes are used and where

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/MSHARED-632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15978039#comment-15978039 ]

ASF GitHub Bot commented on MSHARED-632:
----------------------------------------

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 <[hidden email]>
Date:   2017-04-21T03:41:32Z

    Expose which dependency classes are used and where

----


> Expose which dependency classes are used and where
> --------------------------------------------------
>
>                 Key: MSHARED-632
>                 URL: https://issues.apache.org/jira/browse/MSHARED-632
>             Project: Maven Shared Components
>          Issue Type: New Feature
>          Components: maven-dependency-analyzer
>            Reporter: Jonathan Haber
>            Priority: Minor
>
> 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, the first step is to update the maven-dependency-analyzer to return this information so that the maven-dependency-plugin can use it.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
Loading...