Why maven is not showing correct OS version in Mac Big Sur

Viewed 128

I upgraded Mac OS from Catalina to Big Sur but "$mvn --version" shows the os version as 10.16 as:

Maven home: /usr/local/Cellar/maven/3.8.2/libexec
Java version: 1.8.0_192, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

whereas when i run the shell command:

$sw_vers 

i got output as:

ProductName:    macOS
ProductVersion: 11.5.2
BuildVersion:   20G95

So why mvn --version does not show OS version as 11.5.2?

1 Answers

As mentioned by geobreeze:

Maven uses System.getProperty("os.version") code to get system's version. This code depends on native code, which is build backward compatible.

As this article says, if an application is built with 10.15 SDK, it will report Big Sur as 10.16. If an application is built with 11.0 SDK, it will report version 11.

You can try to reinstall java and check again. But 10.16 is a correct version for Big Sur.

Related