Uploaded image for project: 'Maven JDeps Plugin'
  1. Maven JDeps Plugin
  2. MJDEPS-22

dependenciesToAnalyzeIncludes and dependenciesToAnalyzeExcludes don't work as expected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.1
    • None
    • None
    • Windows 10, JDK 1.8.0_181

    Description

      I would like to analyze all dependencies, but those with a groupId starting with "rhc."
      I'm using the following configuration:

                             <configuration>
                                  <dependenciesToAnalyzeIncludes>
                                      <include>*:*</include>
                                  </dependenciesToAnalyzeIncludes>
                                  <dependenciesToAnalyzeExcludes>
                                      <exclude>rhc.*:*</exclude>
                                  </dependenciesToAnalyzeExcludes>
                              </configuration>
      

      I expect the resulting command to look like:

      cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\bin\jdeps.exe" -cp {All rhc.* dependencies} -P [myPath]\target\classes [All other dependencies]

      Instead all the dependencies appear in the classpath (-cp) section and only the classes folder is left at the end.

      Looking at the code, I see that the method getDependenciesToAnalyze in AbstractJDepsMojo does the following:

                      if ( includes.matchesPatternStart( versionlessKey, true ) 
                          && !excludes.matchesPatternStart( versionlessKey, true ) )
                      {
                          jdepsClasses.add( artifact.getFile().toPath() );
                      }
      

      I don't know what "matchesPatternStart" is suppose to do, but the following:

      MatchPatterns.from("org.foo.*:*").matchesPatternStart("com.google.guava:guava", true)
      

      returns true, while I would expect a mismatch here.
      Calling matches instead of matchesPatternStart seems to fix the issue.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jflecomte Jean-François Lecomte
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: