替换 Maven 蚂蚁中的 $ 运行

Replace $ in Maven ant run

我必须在某些文件中进行此替换:

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <phase>package</phase>
            <configuration>
                <tasks>
                    <replace token='${' value='${sys:' dir="${basedir}/target/dist/jboss">
                        <include name="log4j2.xml"/>
                    </replace>
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

我不知道如何逃脱 $ 我最终总是 "An Ant BuildException has occured: Syntax error in property: ${sys:" 我尝试使用 \$&#36;$![CDATA[$]] 来逃避 $,但是 none 有效。

提前感谢您的帮助。

Il.K

问题似乎是由 value 属性中的 ${ 引起的。尝试使用双美元符号转义它:

<replace token='${' value='$${sys:' dir="${basedir}/target/dist/jboss"> 
   <include name="log4j2.xml"/>
</replace>