You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jean-François Lecomte (JIRA)" <ji...@apache.org> on 2019/02/07 16:05:00 UTC

[jira] [Created] (MJDEPS-22) dependenciesToAnalyzeIncludes and dependenciesToAnalyzeExcludes don't work as expected

Jean-François Lecomte created MJDEPS-22:
-------------------------------------------

             Summary: dependenciesToAnalyzeIncludes and dependenciesToAnalyzeExcludes don't work as expected
                 Key: MJDEPS-22
                 URL: https://issues.apache.org/jira/browse/MJDEPS-22
             Project: Maven JDeps Plugin
          Issue Type: Bug
    Affects Versions: 3.1.1
         Environment: Windows 10, JDK 1.8.0_181
            Reporter: Jean-François Lecomte


I would like to analyze all dependencies, but those with a groupId starting with "rhc."
I'm using the following configuration:
{code:xml}
                       <configuration>
                            <dependenciesToAnalyzeIncludes>
                                <include>*:*</include>
                            </dependenciesToAnalyzeIncludes>
                            <dependenciesToAnalyzeExcludes>
                                <exclude>rhc.*:*</exclude>
                            </dependenciesToAnalyzeExcludes>
                        </configuration>
{code}

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:
{code:java}
                if ( includes.matchesPatternStart( versionlessKey, true ) 
                    && !excludes.matchesPatternStart( versionlessKey, true ) )
                {
                    jdepsClasses.add( artifact.getFile().toPath() );
                }
{code}

I don't know what "matchesPatternStart" is suppose to do, but the following:
{code}
MatchPatterns.from("org.foo.*:*").matchesPatternStart("com.google.guava:guava", true)
{code}
returns true, while I would expect a mismatch here.
Calling matches instead of matchesPatternStart seems to fix the issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)