diff --git a/src/main/java/org/ballerinalang/command/cmd/ListCommand.java b/src/main/java/org/ballerinalang/command/cmd/ListCommand.java index a7289be6..ff3d8afa 100644 --- a/src/main/java/org/ballerinalang/command/cmd/ListCommand.java +++ b/src/main/java/org/ballerinalang/command/cmd/ListCommand.java @@ -159,8 +159,13 @@ private static void listDistributions(PrintStream outStream, boolean allFlag, bo else { outStream.println("\n" + channel.getName() + "\n"); List channelDistList = channel.getDistributions(); - if (channel.getName().equals("Swan Lake channel")) { - channelDistList.sort(Comparator.comparing(Distribution::getVersion)); + if (channel.getName().equals("Swan Lake channel") || channel.getName().equals("1.* channel")) { + Comparator semverComparator = Comparator + .comparingInt((Distribution distribution) -> Integer.parseInt(distribution.getVersion().split("\\.")[0])) + .thenComparingInt((Distribution distribution) -> Integer.parseInt(distribution.getVersion().split("\\.")[1])) + .thenComparingInt((Distribution distribution) -> Integer.parseInt(distribution.getVersion().split("\\.")[2])); + + channelDistList.sort(semverComparator); Collections.reverse(channelDistList); } if (!allFlag){