This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-archetype.git
commit b4cc034a5b7b714899d0a3098b07923d234866b5 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Sat Oct 31 17:46:32 2026 +0000 Replace commons-collections4 with JDK collections --- archetype-common/pom.xml | 5 ----- .../apache/maven/archetype/creator/FilesetArchetypeCreator.java | 5 ++--- maven-archetype-plugin/pom.xml | 5 ----- .../org/apache/maven/archetype/mojos/IntegrationTestMojo.java | 9 +++++++-- pom.xml | 5 ----- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/archetype-common/pom.xml b/archetype-common/pom.xml index c58795f0..76262b78 100644 --- a/archetype-common/pom.xml +++ b/archetype-common/pom.xml @@ -113,11 +113,6 @@ <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - <version>4.6.0</version> - </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-xml</artifactId> diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java index e6d59a0f..b87a8563 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java @@ -44,7 +44,6 @@ import java.util.Set; import com.ibm.icu.text.CharsetDetector; import com.ibm.icu.text.CharsetMatch; -import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.maven.archetype.ArchetypeCreationRequest; import org.apache.maven.archetype.ArchetypeCreationResult; @@ -146,8 +145,8 @@ public class FilesetArchetypeCreator implements ArchetypeCreator { archetypePostGenerationScript.getParentFile().mkdirs(); if (request.getProject().getBuild() != null - && CollectionUtils.isNotEmpty( - request.getProject().getBuild().getResources())) { + && request.getProject().getBuild().getResources() != null + && !request.getProject().getBuild().getResources().isEmpty()) { for (Resource resource : request.getProject().getBuild().getResources()) { File inputFile = new File( resource.getDirectory() + File.separator + Constants.ARCHETYPE_POST_GENERATION_SCRIPT); diff --git a/maven-archetype-plugin/pom.xml b/maven-archetype-plugin/pom.xml index cc2ecdb3..b66aee61 100644 --- a/maven-archetype-plugin/pom.xml +++ b/maven-archetype-plugin/pom.xml @@ -134,11 +134,6 @@ <groupId>org.apache.velocity</groupId> <artifactId>velocity-engine-core</artifactId> </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - <version>4.6.0</version> - </dependency> <dependency> <groupId>org.junit.jupiter</groupId> diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java index d31d0bb5..6caf08c6 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java @@ -34,6 +34,7 @@ import java.nio.file.Files; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -42,7 +43,6 @@ import java.util.Objects; import java.util.Properties; import java.util.Set; -import org.apache.commons.collections4.CollectionUtils; import org.apache.maven.archetype.ArchetypeGenerationRequest; import org.apache.maven.archetype.ArchetypeGenerationResult; import org.apache.maven.archetype.common.Constants; @@ -344,7 +344,12 @@ public class IntegrationTestMojo extends AbstractMojo { List<String> actualFiles = FileUtils.getFileAndDirectoryNames(actual, "**", null, false, true, true, true); getLog().debug("actual content: " + actualFiles); - boolean fileNamesEquals = CollectionUtils.isEqualCollection(referenceFiles, actualFiles); + // same elements with the same cardinalities, regardless of order + List<String> sortedReferenceFiles = new ArrayList<>(referenceFiles); + Collections.sort(sortedReferenceFiles); + List<String> sortedActualFiles = new ArrayList<>(actualFiles); + Collections.sort(sortedActualFiles); + boolean fileNamesEquals = sortedReferenceFiles.equals(sortedActualFiles); if (!fileNamesEquals) { getLog().debug("Actual list of files is not the same as reference:"); diff --git a/pom.xml b/pom.xml index fe8421cc..32ca1dd7 100644 --- a/pom.xml +++ b/pom.xml @@ -179,11 +179,6 @@ <artifactId>velocity-engine-core</artifactId> <version>2.4.1</version> </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - <version>4.6.0</version> - </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId>
