maven replace引起的问题

项目打包的时候,js文件后缀类似这样的,a.js?v==TIMESTAMP 没有replace成功:

其中pom.xml配置如下:

<plugin>
				<groupId>com.google.code.maven-replacer-plugin</groupId>
				<artifactId>replacer</artifactId>
				<version>1.5.0</version>
				<executions>
					<execution>
						<!-- the replace should happen before the app is packaged -->
						<id>replace-for-compile</id>
						<phase>compile</phase>
						<goals>
							<goal>replace</goal>
						</goals>
						<configuration>
							<includes>
								<!-- replace the token in this file -->
								<include>**/target/**/*.jsp</include>
							</includes>
							<encoding>UTF-8</encoding>
							<regex>false</regex>
							<!-- the name of the token to replace -->
							<token>TIMESTAMP</token>
							<!-- replace it with the maven project version -->
							<value>${maven.build.timestamp}</value>
						</configuration>
					</execution>
					<execution>
						<id>replace-for-generate</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>replace</goal>
						</goals>
						<configuration>
							<includes>
								<!-- replace the token in this file -->
								<include>**/src/main/resources/**/*.xml</include>
								<include>**/src/main/webapp/WEB-INF/*.xml</include>
								<include>**/src/main/resources/*.properties</include>
								<include>**/src/test/java/com/tf8/util/TestBeanFactory.java</include>
							</includes>
							<encoding>UTF-8</encoding>
							<regex>false</regex>
							<!-- the name of the token to replace -->
							<token>__artifactId__</token>
							<!-- replace it with the maven project version -->
							<value>invite</value>
						</configuration>
					</execution>
				</executions>
			</plugin>

后来修改成如下,主要是去掉了replace-for-generate



 

成功。

猜你喜欢

转载自cfyme.iteye.com/blog/2210334