apache / apache/maven-jdeps-plugin
[MJDEPS-22] dependenciesToAnalyzeIncludes and dependenciesToAnalyzeExcludes don't work as expected
- Dominant language
- Java
- Stars
- 18
- Forks
- 18
- Avg merge
- 9h 12m
- Merged PRs (30d)
- 5
Description
**[Jean-François Lecomte](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jflecomte)** opened **[MJDEPS-22](https://issues.apache.org/jira/browse/MJDEPS-22?redirect=false)** and commented
I would like to analyze all dependencies, but those with a groupId starting with "rhc."
I'm using the following configuration:
```xml
*:*
rhc.*:*
```
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:
```java
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.
---
**Affects:** 3.1.1
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in AbstractJDepsMojo#getDependenciesToAnalyze and inspect how MatchPatterns.matchesPatternStart handles the supplied include and exclude patterns, comparing it with matches using the example configuration. Verify that matching dependencies and excluded rhc.* dependencies are separated correctly between the jdeps classpath and remaining arguments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100