maven中的os.detected.classifier如何得到

水深无声 2023-07-10 08:09 157阅读 0赞

1)随便建一个class,main中写:

  1. System.out.println(System.getProperty("os.name"));
  2. System.out.println(System.getProperty("os.arch"));

执行后得到类似:

  1. Windows
  2. amd64

2)然后打开网页:

  1. https://github.com/trustin/os-maven-plugin

20200229235049436.png

很清楚,os.detected.classifier由os.detected.name和os.detected.arch决定。

os.detected.name和os.detected.arch都有相应的值对应:

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM5MzI2NDcy_size_16_color_FFFFFF_t_70

查看 Windows和amd64对应的值,在 pom.xmlproperties 中新增:

  1. <os.detected.classifier>windows-x86_64</os.detected.classifier>

就可以在maven中使用${os.detected.classifier}啦,不会报错了。

发表评论

表情:
评论列表 (有 0 条评论,157人围观)

还没有评论,来说两句吧...

相关阅读