Maven:找出是在32位还是64位JVM中运行 [英] Maven: Finding out whether running in a 32 or a 64 bit JVM

查看:121
本文介绍了Maven:找出是在32位还是64位JVM中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据正在执行maven的VM是32位还是64位JVM来启用或禁用maven配置文件?

How can I enable or disable a maven profile based on whether the VM that is executing maven is a 32 bit or a 64 bit JVM ?

我尝试过:

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

amd64分别检测32/64位VM,但这在激活64位配置文件的64位Windows上运行的32位VM上失败.

or amd64 respectively to detect a 32/64 bit VM, but this fails on a 32 bit VM running on a 64 bit Windows as it activates the 64 bit profile.

推荐答案

在Sun VM中, 检查系统属性sun.arch.data.model

In a Sun VM, check for the system property 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>

参考:

这篇关于Maven:找出是在32位还是64位JVM中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆