我在网上搜索,找不到任何好的文件来解释这个问题。有人可以帮我学习maven语义吗?
实施例: -
MAVEN_OPTS=" -Xms512m -Xmx1024m -XX:MaxPermSize=1024m"
export MAVEN_OPTS
"-Xms512m -Xmx1024m -XX:MaxPermSize=1024m"
的含义是什么?
答案 0 :(得分:10)
文档很棒,但并不总是完整的。您可以做一些额外的事情来自己解决问题。在这种情况下,您知道MAVEN_OPTS是一个环境变量,这可能意味着它在shell脚本中使用。所以打开例如mvn.bat并搜索MAVEN_OPTS以查看它是如何使用的。
您会发现它只是一种指定Java命令行参数的方法,这些参数将对Maven本身的执行起作用。作为过去的一个例子,我需要增加默认的permgen大小,以防止在执行复杂构建期间出现问题。
答案 1 :(得分:9)
在完成上述评论之后,我澄清了我对MAVEN_OPTS和maven语义的怀疑。请参阅this链接并浏览文档。
-Xmsn
Specifies the initial size, in bytes, of the memory allocation pool. This value
must be a multiple of 1024 greater than 1 MB. Append the letter k or K to indicate kilobytes,
or m or M to indicate megabytes. The default value is chosen at runtime based on system configuration. See Garbage Collector Ergonomics at
[http://docs.oracle.com/javase/7/docs/technotes/guides/vm/gc-ergonomics.html][2]
Examples:
-Xms6291456
-Xms6144k
-Xms6m
-Xmxn
Specifies the maximum size, in bytes, of the memory allocation pool. This value
must a multiple of 1024 greater than 2 MB. Append the letter k or K to indicate kilobytes, or m
or M to indicate megabytes. The default value is chosen at runtime based on system
configuration.
For server deployments, -Xms and -Xmx are often set to the same value. See Garbage
Collector Ergonomics at
[http://docs.oracle.com/javase/7/docs/technotes/guides/vm/gc-ergonomics.html][3]
Examples:
-Xmx83886080
-Xmx81920k
-Xmx80m