我正在尝试使用 maven-replacer-plugin 查找并替换带有 pom.xml 的 html 标记。使用当前配置,我收到“缺少结束标记地址”的错误,这意味着 pom 没有转义 open tag<
和 close tag >
。
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<id>replace-script-reset-path-variable</id>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<includes>
<include>${basedir}/books/*.xml</include>
</includes>
<replacements>
<replacement>
<token>/<(address)>/</token>
<value>/<(address)>//abc.com</value>
</replacement>
</replacements>
</configuration>
</execution>
</executions>
</plugin>
目的是将源文件中具有 html 标记的所有行替换<address>
为<address>abc.com/
这是我的源文件的示例:
<address>books/category/ebooks1/index.html</address>
<address>books/category/ebooks2/index.html</address>
<address>books/category/ebooks3/index.html</address>
<address>books/category/ebooks4/index.html</address>
<address>books/category/ebooks5/index.html</address>
应用正则表达式后,预期的源文件应为:
<address>abc.com/books/category/ebooks1/index.html</address>
<address>abc.com/books/category/ebooks2/index.html</address>
<address>abc.com/books/category/ebooks3/index.html</address>
<address>abc.com/books/category/ebooks4/index.html</address>
<address>abc.com/books/category/ebooks5/index.html</address>