Maven:如何确定正在运行的是32位还是64位JVM

7

如何根据执行maven的虚拟机是32位还是64位来启用或禁用maven配置文件?

我尝试了以下方法:

<activation>
   <os>
       <arch>x86</arch>
   </os>
 </activation>

为了检测32/64位的虚拟机,可以使用i386amd64参数,但在64位Windows上运行的32位虚拟机上,这种方法会激活64位配置文件,因此无法正常工作。

1个回答

7
在Sun虚拟机中,检查系统属性sun.arch.data.model
<profiles>
<profile>
  <id>32bitstuff</id>
  <activation>
    <property>
      <name>sun.arch.data.model</name>
      <value>32</value>
    </property>
  </activation>
</profile>

<profile>
  <id>64bitstuff</id>
  <activation>
    <property>
      <name>sun.arch.data.model</name>
      <value>64</value>
    </property>
  </activation>
</profile>

</profiles>

参考文献:


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接