[英]Increase memory of tomcat7 maven plugin?
我想使用tomcat7-maven-plugin直接從maven啟動一個嵌入式tomcat7實例。 這工作正常,但Tomcat啟動似乎沒有足夠的內存。 我懷疑我需要設置
-XX:MaxPermSize=256m
但我無法弄清楚該怎么做。
文檔說應該使用插件的“配置”部分中的“systemProperties”元素。 但是,選項被指定為XML元素,並且需要看起來像這樣:
<configuration>
<systemProperties>
<XX:MaxPermSize>256m</XX:MaxPermSize>
</systemProperties>
</configuration>
但這當然不可能,因為它打破了XML(XX被解釋為命名空間)。
當然,我可以通過設置環境變量來解決這個問題
MAVEN_OPTS=-XX:MaxPermSize=256m
但我寧願只為嵌入式Tomcat增加它。 任何想法如何做到這一點?
正如大多數人在上面的評論中所說,pom.xml中的屬性沒有效果。 對我有用的是設置我的MAVEN_OPTS
MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
或者在cmd終端的Windows上:
set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=256m
對於mac / linux用戶,只需在〜/ .profile(或類似文件名)中添加一個export語句。 例如:
export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
然后重啟你的shell。
您可以通過這種方式設置屬性
<configuration>
<systemProperties>
<JAVA_OPTS>-Xms256m -Xmx512m -XX:MaxPermSize=256m</JAVA_OPTS>
</systemProperties>
</configuration>
這個對我有用:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>...</version>
<configuration>
<container>...</container>
<configuration>
<type>standalone</type>
<home>...</home>
<properties>
<cargo.jvmargs>-Xmx4096m</cargo.jvmargs>
</properties>
</configuration>
<deployables>...</deployables>
</configuration>
</plugin>
它在一個帶有參數“-Xmx4096m”的新JVM中啟動我的tomcat8。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.