[ 
https://issues.apache.org/jira/browse/MJDEPS-22?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jean-François Lecomte updated MJDEPS-22:
----------------------------------------
    Description: 
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:
{code}
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]{code}

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.

  was:
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.


> 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
>            Priority: Major
>
> 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:
> {code}
> 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]{code}
> 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)

Reply via email to