Description
That is:
1.8.4-SNAPSHOT < 1.8.4
This doesn't appear to be happening... the comparator strips off the "-SNAPSHOT" qualifier, but then ignores it entirely.
This is relevant because when loading modules, if it finds multiple modules with the same ID it chooses the "most recent" one and deletes the others from the file system.
So, for example, if you have the following two modules in your modules directory:
somemodule-1.8.4-SNAPSHOT
somemodule-1.8.4
"somemodule-1.8.4-SNAPSHOT" will be started, and "somemodule-1.8.4" will be removed, when really you'd want to keep "somemodule-1.8.4" as it is the most recent version.
To reproduce, you can take the existing test:
@Test @Verifies(value = "treat SNAPSHOT as earliest version", method = "compareVersion(String,String)") public void compareVersion_shouldTreatSNAPSHOTAsEarliestVersion() throws Exception { String olderVersion = "1.8.3"; String newerVersion = "1.8.4-SNAPSHOT"; Assert.assertTrue(ModuleUtil.compareVersion(newerVersion, olderVersion) > 0); //should still return the correct value if the arguments are switched Assert.assertTrue(ModuleUtil.compareVersion(olderVersion, newerVersion) < 0); }
and set the older version to "1.8.4-SNAPSHOT" and the newer version to "1.8.4".