Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.9
    • Fix Version/s: 3.0.1
    • Component/s: analyze
    • Labels:
      None
    • Environment:
      Mac OSX
      13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

      Description

      It is possible to get the depedency plugin to fail to recognize methods references.

      For example, the following function declaration is the only place in its class where the Guava "Lists" class is referenced (apart from imports):

      public static <V> SequenceMap<String, Character, V> forStringKeys()

      { return new SequenceMap<>(Lists::charactersOf); }

      We choose to fail when declared dependencies are thought to be unused, and this usage is simply not detected, resulting in the following output and exception:

      [WARNING] Unused declared dependencies found:
      [WARNING] com.google.guava:guava:jar:18.0:compile
      [INFO] ------------------------------------------------------------------------

      Caused by: org.apache.maven.plugin.MojoExecutionException: Dependency problems found
      at org.apache.maven.plugin.dependency.analyze.AbstractAnalyzeMojo.execute(AbstractAnalyzeMojo.java:187)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)

      Will try to get a test and patch attached to this once I figure out where your test case class file resources are coming from.

        Issue Links

          Activity

          Hide
          jhaber Jonathan Haber added a comment -

          Has there been any progress on this? I could try to work on a patch but don't want to duplicate work.

          Show
          jhaber Jonathan Haber added a comment - Has there been any progress on this? I could try to work on a patch but don't want to duplicate work.
          Hide
          khmarbaise Karl Heinz Marbaise added a comment -

          Not that i know...

          Show
          khmarbaise Karl Heinz Marbaise added a comment - Not that i know...
          Hide
          krosenvold Kristian Rosenvold added a comment -

          You should try the latest Snapshot version, it may do the trick for you...

          Show
          krosenvold Kristian Rosenvold added a comment - You should try the latest Snapshot version, it may do the trick for you...
          Hide
          jhaber Jonathan Haber added a comment -

          Ah, I see, https://github.com/apache/maven-shared/commit/d8404aa19875ce7dc9d912a1f8b65a3b97bfdd08

          However, the latest snapshot of maven-dependency-plugin isn't using a snapshot of maven-dependency-analyzer so it doesn't pick up that commit. Overriding the maven-dependency-analyzer version to 1.7-SNAPSHOT when declaring the maven-dependency-plugin does the trick though. But I hit an issue with the ConstantPoolParser throwing an exception when parsing certain class files. I tracked it down to some missing code when it was ported from the stack overflow answer and sent a PR https://github.com/apache/maven-shared/pull/10 with a fix and a small test change that shows the broken behavior before and the fixed behavior after.

          In the meantime we'll run our fork, but let me know if you want me to make any changes to the PR, or feel free to close the PR and incorporate the changes in svn directly since it's pretty trivial.

          Show
          jhaber Jonathan Haber added a comment - Ah, I see, https://github.com/apache/maven-shared/commit/d8404aa19875ce7dc9d912a1f8b65a3b97bfdd08 However, the latest snapshot of maven-dependency-plugin isn't using a snapshot of maven-dependency-analyzer so it doesn't pick up that commit. Overriding the maven-dependency-analyzer version to 1.7-SNAPSHOT when declaring the maven-dependency-plugin does the trick though. But I hit an issue with the ConstantPoolParser throwing an exception when parsing certain class files. I tracked it down to some missing code when it was ported from the stack overflow answer and sent a PR https://github.com/apache/maven-shared/pull/10 with a fix and a small test change that shows the broken behavior before and the fixed behavior after. In the meantime we'll run our fork, but let me know if you want me to make any changes to the PR, or feel free to close the PR and incorporate the changes in svn directly since it's pretty trivial.
          Hide
          stevenschlansker Steven Schlansker added a comment - - edited

          Any movement here? We're still impacted by this issue, a year later... Looks like a fix at this point might be as simple as updating mdep's dependencies and making a new release?

          Show
          stevenschlansker Steven Schlansker added a comment - - edited Any movement here? We're still impacted by this issue, a year later... Looks like a fix at this point might be as simple as updating mdep's dependencies and making a new release?
          Hide
          khmarbaise Karl Heinz Marbaise added a comment -

          Which version of maven-dependency-plugin are you using?

          Show
          khmarbaise Karl Heinz Marbaise added a comment - Which version of maven-dependency-plugin are you using?
          Hide
          stevenschlansker Steven Schlansker added a comment -

          I just confirmed the problem is still reproducible with 3.0.0

          Show
          stevenschlansker Steven Schlansker added a comment - I just confirmed the problem is still reproducible with 3.0.0
          Hide
          khmarbaise Karl Heinz Marbaise added a comment -

          First thanks for your confirmation. Do you have an example project which shows that problem?

          Show
          khmarbaise Karl Heinz Marbaise added a comment - First thanks for your confirmation. Do you have an example project which shows that problem?
          Hide
          jhaber Jonathan Haber added a comment -

          The issue is already fixed in trunk, it's just waiting on a 1.7 release of the maven-dependency-analyzer and for the maven-dependency-plugin to depend on this new version. For what it's worth, we've been using 1.7-SNAPSHOT of the maven-dependency-analyzer for about a year across a relatively large Java 8 codebase without issue.

          Show
          jhaber Jonathan Haber added a comment - The issue is already fixed in trunk, it's just waiting on a 1.7 release of the maven-dependency-analyzer and for the maven-dependency-plugin to depend on this new version. For what it's worth, we've been using 1.7-SNAPSHOT of the maven-dependency-analyzer for about a year across a relatively large Java 8 codebase without issue.
          Hide
          stevenschlansker Steven Schlansker added a comment -

          I can provide a sample project if need be, but I agree with Jonathan that it should just be releasing the components and plugins.

          Show
          stevenschlansker Steven Schlansker added a comment - I can provide a sample project if need be, but I agree with Jonathan that it should just be releasing the components and plugins.
          Hide
          jhaber Jonathan Haber added a comment -

          This is the relevant MSHARED JIRA for reference https://issues.apache.org/jira/browse/MSHARED-428

          Show
          jhaber Jonathan Haber added a comment - This is the relevant MSHARED JIRA for reference https://issues.apache.org/jira/browse/MSHARED-428
          Hide
          khmarbaise Karl Heinz Marbaise added a comment -

          Update to release version of dependency-analyzer

          Show
          khmarbaise Karl Heinz Marbaise added a comment - Update to release version of dependency-analyzer
          Hide
          khmarbaise Karl Heinz Marbaise added a comment -

          Done in r1793689

          Show
          khmarbaise Karl Heinz Marbaise added a comment - Done in r1793689
          Hide
          benhardy Ben Hardy added a comment -

          Thank you!

          Show
          benhardy Ben Hardy added a comment - Thank you!
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-plugins #8949 (See https://builds.apache.org/job/maven-plugins/8949/)
          MDEP-471 Java 8 Method references are not detected
          o Fixed by using released version of maven-dependency-analyzer
          which contains fix. (khmarbaise: http://svn.apache.org/viewvc/?view=rev&rev=1793689)

          • (edit) maven-dependency-plugin/pom.xml
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-plugins #8949 (See https://builds.apache.org/job/maven-plugins/8949/ ) MDEP-471  Java 8 Method references are not detected o Fixed by using released version of maven-dependency-analyzer which contains fix. (khmarbaise: http://svn.apache.org/viewvc/?view=rev&rev=1793689 ) (edit) maven-dependency-plugin/pom.xml

            People

            • Assignee:
              khmarbaise Karl Heinz Marbaise
              Reporter:
              benhardy Ben Hardy
            • Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development