You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2026/07/22 11:42:11 UTC
(maven-toolchains-plugin) branch master updated (41eb940 -> b83d216)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-toolchains-plugin.git
from 41eb940 [maven-release-plugin] prepare for next development iteration
add 5d385b6 Fix version comparator: use numeric comparison instead of lexicographic string comparison (#166)
new b83d216 Expand version comparator test with multi-part version strings
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../plugins/toolchain/jdk/ToolchainDiscoverer.java | 25 ++++----
.../toolchain/jdk/ToolchainDiscovererTest.java | 67 ++++++++++++++++++++++
2 files changed, 80 insertions(+), 12 deletions(-)
(maven-toolchains-plugin) 01/01: Expand version comparator test with multi-part version strings
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-toolchains-plugin.git
commit b83d216c634618d3d92f7d9be11ca42b43fcb000
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Wed Jul 22 11:42:06 2026 +0000
Expand version comparator test with multi-part version strings
---
.../toolchain/jdk/ToolchainDiscovererTest.java | 34 ++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/test/java/org/apache/maven/plugins/toolchain/jdk/ToolchainDiscovererTest.java b/src/test/java/org/apache/maven/plugins/toolchain/jdk/ToolchainDiscovererTest.java
index 2ab09d6..4a0907f 100644
--- a/src/test/java/org/apache/maven/plugins/toolchain/jdk/ToolchainDiscovererTest.java
+++ b/src/test/java/org/apache/maven/plugins/toolchain/jdk/ToolchainDiscovererTest.java
@@ -84,4 +84,38 @@ public class ToolchainDiscovererTest {
assertEquals("11", list.get(1).getProvides().getProperty("version"));
assertEquals("8", list.get(2).getProvides().getProperty("version"));
}
+
+ @Test
+ void testVersionComparatorMultiPart() {
+ ToolchainDiscoverer discoverer = new ToolchainDiscoverer();
+
+ ToolchainModel v1 = new ToolchainModel();
+ v1.setType("jdk");
+ v1.addProvide("version", "11.0.1");
+
+ ToolchainModel v2 = new ToolchainModel();
+ v2.setType("jdk");
+ v2.addProvide("version", "11.0.31");
+
+ ToolchainModel v3 = new ToolchainModel();
+ v3.setType("jdk");
+ v3.addProvide("version", "17.0.1");
+
+ ToolchainModel v4 = new ToolchainModel();
+ v4.setType("jdk");
+ v4.addProvide("version", "1.8");
+
+ List<ToolchainModel> list = new ArrayList<>();
+ list.add(v1);
+ list.add(v2);
+ list.add(v3);
+ list.add(v4);
+
+ list.sort(discoverer.version());
+
+ assertEquals("17.0.1", list.get(0).getProvides().getProperty("version"));
+ assertEquals("11.0.31", list.get(1).getProvides().getProperty("version"));
+ assertEquals("11.0.1", list.get(2).getProvides().getProperty("version"));
+ assertEquals("1.8", list.get(3).getProvides().getProperty("version"));
+ }
}