简体   繁体   中英

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

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?

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, application 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 correct version for Big Sur.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM