@@ -55,15 +55,35 @@ public final class SufFixMojo extends AbstractMojo {
55
55
return temp ;
56
56
});
57
57
58
- public void execute () {
59
- final var artifacts = (Set <Artifact >)Collections .unmodifiableSet (project .getDependencyArtifacts ());
60
- libraries .stream ().map (libraryName ->
61
- artifacts .stream ()
62
- .filter (art -> art .getArtifactId ().toLowerCase ().contains (libraryName ))
58
+ final private Lazy <Set <Artifact >> artifacts =
59
+ Lazy .of (() -> (Set <Artifact >)Collections .unmodifiableSet (project .getDependencyArtifacts ()));
60
+
61
+ private Optional <Tuple2 <File , String >> findManifestToFix (String libraryName ) {
62
+ if (libraryName .contains (":" )) {
63
+ var split = libraryName .split (":" );
64
+ if (split .length > 1 ) {
65
+ final var groupId = split [0 ].trim ();
66
+ final var artifactId = split [1 ].trim ();
67
+ return artifacts .get ().stream ()
68
+ .filter (art -> art .getGroupId ().equals (groupId ) && art .getArtifactId ().equals (artifactId ))
69
+ .findAny ()
70
+ .map (art -> Tuple .of (art .getFile (), libraryName ));
71
+ } else {
72
+ return Optional .empty ();
73
+ }
74
+ } else {
75
+ return artifacts .get ().stream ()
76
+ .filter (art -> art .getArtifactId ().trim ().equals (libraryName ))
63
77
.findAny ()
64
- .map (art -> Tuple .of (art .getFile (), libraryName ))
65
- ).flatMap (Optional ::stream )
66
- .forEach (this ::fixManifest );
78
+ .map (art -> Tuple .of (art .getFile (), libraryName ));
79
+ }
80
+ }
81
+
82
+ public void execute () {
83
+ libraries .stream ()
84
+ .map (this ::findManifestToFix )
85
+ .flatMap (Optional ::stream )
86
+ .forEach (this ::fixManifest );
67
87
}
68
88
69
89
private void fixManifest (Tuple2 <File , String > tuple ) {
0 commit comments