在pom.xml中转义属性

EFa*_*lco 5 java maven-2 launch4j

我想在pom.xml中转义一个属性.不是在资源中,我知道可以使用过滤器.例如,我尝试使用launch4j插件,如下所示:

<plugin>
<groupId>org.bluestemsoftware.open.maven.plugin</groupId>
            <artifactId>launch4j-plugin</artifactId>
                <executions>
                    <execution>
                        <id>l4j-cli</id>
                        <phase>install</phase>
                        <goals>
                            <goal>launch4j</goal>
                        </goals>
                        <configuration>
                            <headerType>console</headerType>
                            <outfile>../out.exe</outfile>
                            <dontWrapJar>true</dontWrapJar>
                            <jar>./../out.jar</jar>
                            <icon>../icon.ico</icon>
                            <chdir>.</chdir>
                            <customProcName>true</customProcName>
                            <downloadUrl>http://www.oracle.com/technetwork/java/javase/downloads/index.html</downloadUrl>
                            <classPath>
                                <mainClass>com.stack.Main</mainClass>
                                <addDependencies>true</addDependencies>
                                <jarLocation>./lib</jarLocation>
                            </classPath>
                            <jre>
                                <opts>
                                    <opt>-DconfigBasePath=${ALLUSERSPROFILE}/dir</opt>
       </opts>                          
                            </jre>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
Run Code Online (Sandbox Code Playgroud)

并且$ {ALLUSERSPROFILE}不能由maven解释,而是由launch4j生成的程序.我尝试:

\${ALLUSERSPROFILE}
\\${ALLUSERSPROFILE}
$${ALLUSERSPROFILE}
Run Code Online (Sandbox Code Playgroud)

<properties>
   <dollar>$</dollar>
</properties>
${dollar}{ALLUSERSPROFILE}
Run Code Online (Sandbox Code Playgroud)

但没什么用.

Ren*_*aud 0

当我想通过解析键'${log4j.dir}'和 pom 属性值'${user.home}'来过滤log4j.properties文件时,我添加了同样的问题。

$${key} hack 和 ${dollar}{key} hack 对我来说都不起作用。我最终设法使用 pom 属性中 $ char 的十六进制表示法来完成此操作。

<project>
    <properties>
    <log4j.dir>\u0024{user.home}</log4j.dir>
    </properties>
    <!--...-->
</project>
Run Code Online (Sandbox Code Playgroud)