1)隨便建一個class,main中寫:
System.out.println(System.getProperty("os.name"));
System.out.println(System.getProperty("os.arch"));
執行後得到類似:
Windows
amd64
2)然後打開網頁:
https://github.com/trustin/os-maven-plugin
很清楚,os.detected.classifier由os.detected.name和os.detected.arch決定。
os.detected.name和os.detected.arch都有相應的值對應:
查看 Windows和amd64對應的值,在 pom.xml 的 properties 中新增:
<os.detected.classifier>windows-x86_64</os.detected.classifier>
就可以在maven中使用${os.detected.classifier}啦,不會報錯了。