Developers, Developers, Developers! Maksim Sorokin IT Blog


Comparing Maven String Versions

This posts describes comparint Maven String versions. It is assumed, that you have a Maven-managed project.

Add a maven-artifact dependency


Then you could write something like this:

public int compare(String version1, String version2) {
  ArtifactVersion mavenVersion1 = new DefaultArtifactVersion(version1);
  ArtifactVersion mavenVersion2 = new DefaultArtifactVersion(version2);

  int result = mavenVersion1.compareTo(mavenVersion2);

  return result;
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.