0
我的web.xml
不在${project.root}\src\main\webapp\WEB-INF
。使用Google Maven替换器替换WAR文件中的web.xml中的令牌
我想使用com.google.code.maven-replacer-plugin
来替换它内部的一些标记,当它被打包在WAR中但不在源目录中时,它将被替换为。
我想:
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>src/main/webapp/WEB-INF/web.xml</file>
<replacements>
<replacement>
<token>@@[email protected]@</token>
<value>local</value>
</replacement>
</replacements>
</configuration>
</plugin>
但我得到
[ERROR] File '.\src\main\webapp\WEB-INF\web.xml' does not exist
由于这个文件是不是target
文件结构下的复制,是刚刚从源头上采取直接进入WAR(或因此我想想),我如何在上面的configuration->file
参数中引用它的路径,以便替换者找到它并替换这些标记?
更多信息,更改文件源使用的路径,我想离开源不变(保持令牌),只在构建中更改它,WAR文件 – amphibient
您尝试过使用$ {project.build.directory},但您需要提供适当的阶段(因为在创建war文件之前必须完成该阶段) – ravthiru