khmarbaise commented on code in PR #255: URL: https://github.com/apache/maven-dependency-plugin/pull/255#discussion_r1001889182
########## src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java: ########## @@ -151,15 +150,9 @@ private void createMessage( Set<String> duplicateDependencies, StringBuilder sb, private Set<String> findDuplicateDependencies( List<Dependency> modelDependencies ) { - List<String> modelDependencies2 = new ArrayList<>(); - for ( Dependency dep : modelDependencies ) - { - modelDependencies2.add( dep.getManagementKey() ); - } - - // @formatter:off + List<String> modelDependencies2 = + modelDependencies.stream().map( Dependency::getManagementKey ).collect( Collectors.toList() ); return new LinkedHashSet<>( - CollectionUtils.disjunction( modelDependencies2, new LinkedHashSet<>( modelDependencies2 ) ) ); - // @formatter:on + Util.symmetricDifference( modelDependencies2, new LinkedHashSet<>( modelDependencies2 ) ) ); Review Comment: No they are not the same. The first list (modelDependencies2) contains two entries (junit) while the hashset contains only a single entry of that and the result must be the single junit-jar difference. Check the unit test: `TestAnalyzeDuplicateMojo` testcase `testDuplicate` and `testDuplicate2` which references `src/test/resources/unit/duplicate-dependencies/plugin-config.xml` and the `src/test/resources/unit/duplicate-dependencies/plugin-config2.xml` which contains exactly those cases. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org