1

Let say that there is 2 versions A and B. No matter what exactly they are. How they can be compared with maven? For example:

mvn someGoal A B

result to A is old then B. E.g. can maven check version from command line?

Cherry
  • 31,309
  • 66
  • 224
  • 364
  • 1
    versions of what? can you give an example of a use case? – eis Jan 27 '17 at 08:38
  • what is A and B ? – VedantK Jan 27 '17 at 08:38
  • not sure it would be exactly what you need but maybe you mean something like http://www.mojohaus.org/versions-maven-plugin/examples/display-dependency-updates.html – Redlab Jan 27 '17 at 08:42
  • You can compare things like this: `1.3.2` with `1.3.2-RC1`? Do you mean something like this? – khmarbaise Jan 27 '17 at 08:43
  • `what is A and B ?` Seems you want to analyze versions by your mind? That is what I do **not** want to do :) Just pass two versions, add or modify [comparison rule](http://www.mojohaus.org/versions-maven-plugin/rule.html) and see how itreally works. – Cherry Jan 27 '17 at 09:00
  • Please pass both the versions and then perform your operations : ADD, MODIFY etc. As suggested by @Cherry you can refer this link: http://www.mojohaus.org/versions-maven-plugin/rule.html – Ashraf.Shk786 Jan 27 '17 at 09:15
  • Do you really want a Maven goal? Or invoking `java` [like shown here](http://stackoverflow.com/a/37875486/1743880) is good? What are you trying to achieve? – Tunaki Jan 27 '17 at 09:26

3 Answers3

0

It is not answer for original question, but good workaround. You can just checkou then maven sources with rigth version and then run org.apache.maven.artifact.versioning.ComparableVersion#main from command line, ide, not matter. It display normilized version number, and compare version in passed arguments - very good tool. :)

Cherry
  • 31,309
  • 66
  • 224
  • 364
0

The mentoined way of @Cherry is to use the command line like this:

java -jar apache-maven-3.3.9/lib/maven-artifact-3.3.9.jar 1.3.2 1.3.2-RC1

Display parameters as parsed by Maven (in canonical form) and comparison result:
1. 1.3.2 == 1.3.2
   1.3.2 > 1.3.2-RC1
2. 1.3.2-RC1 == 1.3.2-rc-1
khmarbaise
  • 92,914
  • 28
  • 189
  • 235
0

The mentoined way of @Cherry is to use the command line like this:

java -jar apache-maven-3.3.9/lib/maven-artifact-3.3.9.jar 1.3.2 1.3.2-RC1

Display parameters as parsed by Maven (in canonical form) and comparison result:
1. 1.3.2 == 1.3.2
   1.3.2 > 1.3.2-RC1
2. 1.3.2-RC1 == 1.3.2-rc-1

See also here: https://stackoverflow.com/a/37875486/1743880

Community
  • 1
  • 1
khmarbaise
  • 92,914
  • 28
  • 189
  • 235