我想转义 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>
并且 ${ALLUSERSPROFILE} 不能由 maven 解释,而是由 launch4j 生成的程序解释。我尝试:
\${ALLUSERSPROFILE}
\\${ALLUSERSPROFILE}
$${ALLUSERSPROFILE}
和
<properties>
<dollar>$</dollar>
</properties>
${dollar}{ALLUSERSPROFILE}
但没有任何工作。