xml - Ant xml : How to break the long value attribute for options

标签 xml tomcat ant

我有这个用于 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/

相关文章:

java - 为 pom.xml 构建 XML 标签

tomcat - 如何在 Java 代码中计算 SHA-256 Tomcat 8 DataSourceRealm 兼容哈希?

gwt - 如何使用 Ant 调试 GWT

java - 开始 Hibernate 3.5 - Ant 任务的问题

java - ANT 文件集包含在所有文件系统中

c# - 如何删除 <anyType xsi :type ="my type"> from xml output

python - 如何在python中创建一个xml文档

python - 在 Python 中清理损坏的 XML

xml - Apache cxf 网络服务 : tomcat is showing requested resource not found while server is up for <soap:address>

linux - systemd:成功启动tomcat服务后如何启动tomcat服务