我有这个用于 tomcat.jmx 的 jvmarg 这些选项跨越多行,我想每行打破这些选项。 但这是 Ant 不能接受的。人们如何编写带有长值参数的 xml。
<property name="tomcat.jvmarg.jmx" value="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=${tomcat.jmxport}
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.rmi.port=${tomcat.jmxport} -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.local.only=true -Dcom.sun.management.jmxremote.ssl.need.client.auth=true -Dcom.sun.management.jmxremote.ssl.enabled.protocols=TLSv1 -Djavax.net.ssl.keyStore=${tomcat.jmxkeystore} -Djavax.net.ssl.keyStorePassword=${tomcat.jmxpass}"/>
我试过了,但启动 tomcat 失败了,因为参数中的换行符是一个障碍。
无效
<property name="tomcat.jvmarg.jmx"
value="-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=${tomcat.jmxport}
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.rmi.port=${tomcat.jmxport}
-Djava.rmi.server.hostname=localhost"
/>
最佳答案
是tomcat.jvmarg.jmx
给一个<java>
任务?如果是这样,请考虑嵌套 <jvmarg>
<java>
下的元素...
<java ...>
<jvmarg value="-Dcom.sun.management.jmxremote"/>
<jvmarg value="-Dcom.sun.management.jmxremote.port=${tomcat.jmxport}"/>
<jvmarg value="-Dcom.sun.management.jmxremote.authenticate=false"/>
<jvmarg value="-Dcom.sun.management.jmxremote.ssl=false"/>
<jvmarg value="-Dcom.sun.management.jmxremote.rmi.port=${tomcat.jmxport}"/>
<jvmarg value="-Djava.rmi.server.hostname=localhost"/>
<jvmarg value="-Dcom.sun.management.jmxremote.local.only=true"/>
<jvmarg value="-Dcom.sun.management.jmxremote.ssl.need.client.auth=true"/>
<jvmarg value="-Dcom.sun.management.jmxremote.ssl.enabled.protocols=TLSv1"/>
<jvmarg value="-Djavax.net.ssl.keyStore=${tomcat.jmxkeystore}"/>
<jvmarg value="-Djavax.net.ssl.keyStorePassword=${tomcat.jmxpass}"/>
</java>
这提供了一种轻松查看所有参数同时避免换行问题的方法。
关于xml - Ant xml : How to break the long value attribute for options,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37446924/