我正在使用 Maven 3.2.3。我的 pom.xml 文件中有这个插件……</p>
<!-- creates a test database script from the properties file -->
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>src/test/resources/META-INF/db-test-data.sql.templ</file>
<outputFile>target/test-classes/db-test-data.sql</outputFile>
<tokenValueMap>src/test/resources/test.properties</tokenValueMap>
</configuration>
</plugin>
我注意到当我的“test.properties”文件包含这样的属性时
test.sample.school2.name=Middle $ample Elementary #2
插件执行时出现以下错误...</p>
[ERROR] Failed to execute goal com.google.code.maven-replacer-plugin:replacer:1.5.3:replace (default) on project core: Illegal group reference -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
问题在于替换值中的“$”。如果我删除它,一切都很好。但是,有时被替换的值会有一个“$”。有没有办法将插件配置为接受“$”,或者除此之外,是否有一个等效的插件我可以使用来实现与上述相同的功能?